Re: [PATCH 5/5] commit: only strip diff from message in verbose mode
- From
Jeff King <peff@peff.net>
- Date
- Nov 12, 2008, 08:29 UTC
- Message-ID
- <20081112082947.GA3817@coredump.intra.peff.net>
- In-Reply-To
- <20081112082552.GE3751@coredump.intra.peff.net>
On Wed, Nov 12, 2008 at 03:25:52AM -0500, Jeff King wrote:
Show 9 quoted lines
> +test_expect_success 'diff in message is retained without -v' ' > + git commit --amend -F diff && > + check_message diff > +' > + > +test_expect_failure 'diff in message is retained with -v' ' > + git commit --amend -F diff -v && > + check_message diff > +'
I put in this expect_failure to remind us that we could be doing better. The solution you proposed would fix this test. Another idea I had was to use a bogus diff header, and match on that. Something like:
diff --git --verbose-commit a/file b/file
and searching for "diff --git --verbose-commit", which would not trigger on any diffs (unless, of course, you were trying to explain how the verbose mode worked in your commit message :) ).
But that doesn't cover any other special input (i.e., lines beginning with '#'), and would probably require an ugly hack to the diff machinery (some diff option for "add these bogus diff command line options").
-Peff