author | Jeff King <peff@peff.net> | |
Wed, 12 Nov 2008 08:25:52 +0000 (03:25 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 12 Nov 2008 21:54:31 +0000 (13:54 -0800) | ||
commit | 0b38227f283e208866d3e2ac85bcd947a71f1b17 | |
tree | 0603308f6f02634f6ee8a92ff98fb7ae15012a00 | tree | snapshot |
parent | 9db56f71b91153f4076a796c80c61f00edd8b700 | commit | diff |
commit: Fix stripping of patch in verbose mode.
When the "-v" option is given, we put diff of what is to be committed into
the commit template, and then strip it back out again after the user has
edited it.
We used to look for the diff by searching for the "diff --git a/"
header. With diff.mnemonicprefix set in the configuration, however, this
pattern does not match. The pattern is loosened to cover this case.
Also, if the user puts their own diff in the message (e.g., as a sample
output), then we will accidentally trigger the pattern, removing part of
their output.
We can avoid doing this stripping altogether if the user didn't use "-v"
in the first place, so we know that any match we find will be a false
positive.
[jc: this fix was split out of a series originally meant for master.]
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When the "-v" option is given, we put diff of what is to be committed into
the commit template, and then strip it back out again after the user has
edited it.
We used to look for the diff by searching for the "diff --git a/"
header. With diff.mnemonicprefix set in the configuration, however, this
pattern does not match. The pattern is loosened to cover this case.
Also, if the user puts their own diff in the message (e.g., as a sample
output), then we will accidentally trigger the pattern, removing part of
their output.
We can avoid doing this stripping altogether if the user didn't use "-v"
in the first place, so we know that any match we find will be a false
positive.
[jc: this fix was split out of a series originally meant for master.]
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c | diff | blob | history | |
t/t7507-commit-verbose.sh | [new file with mode: 0755] | blob |