git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Feb 13, 2015, 19:55 UTC
Message-ID
<20150213195528.GA15107@peff.net>
In-Reply-To
<xmqq1tltobgy.fsf@gitster.dls.corp.google.com>
On Fri, Feb 13, 2015 at 11:30:53AM -0800, Junio C Hamano wrote:
Show 10 quoted lines
> > 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
Previous: Junio C HamanoNext: David Glasser
Message 16 of 18 in “Keep original author with git merge --squash?”
  1. David GlasserFeb 11, 2015
  2. Jeff KingFeb 12, 2015
  3. Michael HaggertyFeb 12, 2015
  4. Jeff KingFeb 12, 2015
  5. David GlasserFeb 12, 2015
  6. Junio C HamanoFeb 12, 2015
  7. David GlasserFeb 12, 2015
  8. Junio C HamanoFeb 12, 2015
  9. David GlasserFeb 12, 2015
  10. David GlasserFeb 12, 2015
  11. Junio C HamanoFeb 12, 2015
  12. Jeff KingFeb 12, 2015
  13. Junio C HamanoFeb 12, 2015
  14. Jeff KingFeb 13, 2015
  15. Junio C HamanoFeb 13, 2015
  16. Jeff KingFeb 13, 2015
  17. David GlasserFeb 13, 2015
  18. David GlasserFeb 13, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.