On Thu, Feb 12, 2015 at 4:17 PM, David Glasser <glasser@xxxxxxxxxxxxxxxx> wrote: > On Thu, Feb 12, 2015 at 2:34 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: >> David Glasser <glasser@xxxxxxxxxxxxxxxx> writes: >> >>> So to be concrete: What I'm proposing (and I'm excited to implement >>> it!) is the following: >>> >>> When running "git commit" and: >>> - You've fallen into the case where the message was read from SQUASH_MSG >>> - You haven't used another method of specifying the author (--author, >>> -C, -c, --amend) >>> - You have not specified --reset-author >>> - You have set the "commit.useSquashAuthor" option >>> - Before invoking prepare-commit-msg, all of the `Author:` lines found >>> in SQUASH_MSG have the same value >>> >>> then that author is used, as if it were specified with --author. (And >>> this will show up, commented-out, at the bottom of COMMIT_EDITMSG.) >> >> >> I actually was hoping that this would extend to cases other than >> "git merge --squash". >> >> When running "git commit" and: >> >> - You didn't use a more explicit method of specifying the >> authorship identity (--author, --date, -C, -c --amend, >> --reset-author options, or environment variables GIT_AUTHOR_*); >> >> - You have commit.useAuthorFromEditorComment variable; >> >> - You have "# Author: " line that are identical in the result of >> the editor, >> >> then use that author. That would allow "git commit --amend" to >> update a misspelled author name, for example. >> >> Is that a bit too liberal? Would it invite mistakes? > > That does sound pretty good. And for the specific case of squash, > what I would do would be (a) take one of the existing "Author: " lines > and turn it into an "# Author:" line and (b) do the ordinary editing > that I do to combine the existing messages? > > (Maybe my proposed "detect that they're all the same" code would run > at `merge --squash` time, producing a trailing "# Author:" line if all > of the produced "Author: " lines were identical?) Or, well, as Peff suggested, maybe SQUASH_MSG should look exactly like the message that rebase's squash gives you, which in fact is a lot better: no random indent, "# Author", etc. So making your suggested change to parse "# Author" in `git commit`, plus a second change to make SQUASH_MSG look like rebase's squash, would achieve my goals. -- glasser@xxxxxxxxxxxxxxxx | langtonlabs.org | flickr.com/photos/glasser/ -- 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