Junio C Hamano wrote:
Offhand, an "interesting" side effect of the above I can see is that you will cry "wolf" if the only thing the user did is to add his own Signed-off-by: line ;-) But that is sane in the context of coming up with totally new commit log message.
Yes, that is intentional -- the existing git-commit code wasn't treating Signed-off-by: as content when it checked for a commit message, so I wanted to preserve that behavior.
I am more worried about how this should interact with cases where you usually do not start the log message from scratch. For example, are there cases / policies where being able to use templates to leave comments on merge commits are needed? Squash-commits? Perhaps "apply this template but only when you have hand resolved a conflicting merges"?
Those are all valid cases. They also happen to be ones that are not personally useful to me; none of the stuff in my company's commit template would really apply to merges. I'm happy to do it if you think those cases need to be handled before this can go in, but given there's at least one user out there who doesn't need those things, I wonder if this makes more sense to hold off on until someone actually asks for it.
Or even the case of amending a commit made by somebody else, without changing the tree contents, in order to make the commit log message to conform to the company standard?
It's not clear to me that I can do anything useful in that case, given that there's no way to tell in what way the commit message needs to be fixed up. If it's a case of, "This engineer committed without using the template at all," then I can see an argument for loading the template above / below the existing comment, but IMO a more common case will be something like, "The format is right, but the bug ID isn't filled in or is incorrect," in which case any template I supply would be useless and annoying.
Is your hunch about the common case different than mine? Again, I can go address this if it'll actually be useful. Maybe by always including the template if the command-line option is used, but skipping it in these cases if the config option is used? Or something like that? (On the other hand, if you have to specify the template on the command line, maybe it's easier to just load it into the editor as needed.)
-Steve - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html