Re: git commit -v does not removes the patch
- From
Jeff King <peff@peff.net>
- Date
- Nov 12, 2008, 08:16 UTC
- Message-ID
- <20081112081609.GA3720@coredump.intra.peff.net>
- In-Reply-To
- <7v4p2e2nkg.fsf@gitster.siamese.dyndns.org>
On Tue, Nov 11, 2008 at 09:13:18AM -0800, Junio C Hamano wrote:
Show 12 quoted lines
> We may want to change this. We can say "# Everything under this line is > deleted." at the beginning of the "#" block we produce in the commit log > message editor, replacing the "Lines starting with '#' will be ignored, " > we currently have. When reading back the editor result, make "git commit > -v" scan for the "# Everything ..." line. We remove it and everything > that follows, but we do not touch anything above that line (including the > ones that begin with "diff" or "#") except the usual trailing whitespace > removal. That way, people can leave a sample shell session with root > prompt, and sample diff, in their message. > > If we do not see "# Everything ..." when we read it back, we can do what > we currently do as a fallback.
I am little hesitant to do this, because I think people have scripted minorly around the template format (at the very least, for syntax highlighting). I think some people may have pre-written templates, as well, though I guess your "If we do not see..." paragraph is meant to address that. Though that brings some confusion itself, because now the parsing rules for what is kept change if I delete that line.
Here's a patch series that at least improves the situation by turning off the diff-stripping if we never put in a diff in the first place. That way only people who actually _use_ "-v" will have to pay for it. It has the fix I sent to Santi earlier, as well as some related cleanups.
1/5: define empty tree sha1 as a macro
2/5: wt-status: refactor initial commit printing
3/5: status: show "-v" diff even for initial commit
4/5: commit: loosen pattern for matching "-v" diff
5/5: commit: only strip diff from message in verbose mode-Peff