Subject: Re: Keep original author with git merge --squash?

From: Jeff King <[email-masked]>
Date: Fri, 13 Feb 2015 14:55:28 -0500

On Fri, Feb 13, 2015 at 11:30:53AM -0800, Junio C Hamano wrote:

> > This case collapses nicely if we make a slight tweak to your proposed
> > behavior (or maybe this is what you meant). If there are multiple
> > authors listed, we behave as if none was listed. That would leave the
> > authorship as it behaves today (with the author of the first commit) if
> > you do nothing, or you can override it by dropping all but one.
> 
> I actually was (and am still) wondering that "silently ignore all of
> them if there are multiple ones that contradict with each other" is
> a bad idea, and that was why the last item on the "possible
> alternatives" list was to error out and ask clarification.

Normally I like "error out and ask the user" as an approach to avoiding
mistakes, but I can think of two bad side effects:

  1. If we pre-populate the "# Author:" lines in "git merge --squash",
     then if I run "git commit" on the result and don't explicitly take
     an action to clean up those comment fields, I get an error.  That's
     kind of annoying.

  2. Dumping the user out of "git commit" with an error isn't very
     elegant. They may have put significant work into writing the commit
     message. It's saved there in COMMIT_EDITMSG, but what is the easy
     path to them repeating their action where they left off?

It seems like the potential for confusion comes from the same place as
my complaint (1) above: the implicit-ness of the "# Author:" lines (git
writes them, assumes you've looked at and manipulated them to your
liking, and then reads them back in).

What if there was a step required of the user to say "really, I want to
use this one"? Like converting s/Author/Set-Author/, or taking away the
"#" comment character (though that has its own confusions, as you noted
earlier).

-Peff