Re: [PATCH] Teach git-commit about commit message templates.
- From
Steven Grimm <koreth@midwinter.com>
- Date
- Jul 23, 2007, 10:23 UTC
- Message-ID
- <46A481B4.7000502@midwinter.com>
- In-Reply-To
- <Pine.LNX.4.64.0707231059490.14781@racer.site>
Johannes Schindelin wrote:
Show 7 quoted lines
> Up until here, I was with you. But this feels very wrong. > > Why not compare COMMIT_MSG to the templatefile, if there is one? I.e. > > test ! -z "$templatefile" && cmp "$GIT_DIR"/COMMIT_MSG "$templatefile" && > die "Unchanged message; will not commit" >
The template can itself have comments -- instructions or explanations of fields to fill in, for example -- and since comments have been stripped from COMMIT_MSG at this point, a comparison against such a template would always fail. And, consistent with the current behavior, simply adding a Signed-off-by: line shouldn't count as supplying a commit message.
I could do this test before stripping comments from COMMIT_MSG, but then I'd still fail the comparison if the user just deleted some comment lines manually, which also seems wrong to me -- the comments should be totally ignored when doing this comparison, IMO. Plus that wouldn't ignore Signed-off-by: lines.
If I'm coming at the design the wrong way, I'm of course happy to adjust it, but insensitivity to both comments and Signed-off-by: lines seemed like the right behavior from the user's POV to me, and I didn't see a cleaner way to do it.
Thanks for looking at the patch!
-Steve