Commit graph

2 commits

Author SHA1 Message Date
Jeff King 1324fb6f16 status: show "-v" diff even for initial commit
Since we can use the same "diff against empty tree" trick as
we do for the non-initial case, it is trivial to make this
work.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-12 13:55:17 -08:00
Jeff King 0b38227f28 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>
2008-11-12 13:54:31 -08:00