public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: David Glasser <glasser@davidglasser•net>, git@vger•kernel.org
Subject: Re: Keep original author with git merge --squash?
Date: Thu, 12 Feb 2015 15:32:37 -0800	[thread overview]
Message-ID: <xmqqwq3mogdm.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150212225003.GA20763@peff.net> (Jeff King's message of "Thu, 12 Feb 2015 17:50:03 -0500")

Jeff King <peff@peff•net> writes:

> What happens if there is no "Author:" line in the output?

I've been assuming that we would do what the current code does.
"git commit --amend" for example internally remembers who the
original author was and uses that, without paying any attention to
the result from the editor.  If there is no "Author:", that would
not change.

And I do not think we need to be able to say "Oops, I forgot to pass
the --reset-author option from the command line", personally, so...

> So probably a saner thing is that a missing "Author:" line does nothing,

yes and

> and using "Author: " (with no text) does a reset.

no (I do not think it is wrong per-se, but I do not think such a
good idea).

> Also, on the topic of "merge --squash". I never use it myself, but
> having experimented with it due to this thread, I found the template it
> sticks into COMMIT_EDITMSG to be horribly unfriendly for munging. For
> example, with two simple commits, I get:
>
>     Squashed commit of the following:
>     
>     commit 6821a8ac920ed00675e4aec10dcef705211105cd
>     Author: Jeff King <peff@peff•net>
>     Date:   Thu Feb 12 17:39:28 2015 -0500
>     
>         commit subject 2
>     
>         commit body 2
>     
>     commit b0840bb4bbfe00b6ed8c7c4d483f11d126fa2d69
>     Author: Jeff King <peff@peff•net>
>     Date:   Thu Feb 12 17:39:28 2015 -0500
>     
>         commit subject 1
>     
>         commit body 1
>
> I guess that is helpful if you want to keep a complete log of what got
> squashed, but I doubt that is the common case (if you did, then doing a
> real merge would probably be in order).

I think it should show exactly the same thing as "rebase -i" squash
insn would give you.  People already know how to munge that, right?

> It also raises a question for the proposal in this thread: if there are
> multiple "Author:" lines, which one do we take? The first, or the last?

I was siding with David's "pay attention to in-buffer Author: only
when all of them agree".  When squash-merging a branch with two or
more authors, we would attribute the authorship silently and
automatically to you if you do not do anything special otherwise.

Possible alternatives when multiple "Author:"s do not agree are:

 - use you who is playing the integrator;

 - use the tip;

 - use the one that most often appears; or

 - error out and ask the user to leave only one (or zero--if you
   want to take the authorship) by re-attempting "git commit".

  reply	other threads:[~2015-02-12 23:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 17:21 Keep original author with git merge --squash? David Glasser
2015-02-12  9:28 ` Jeff King
2015-02-12 11:35   ` Michael Haggerty
2015-02-12 12:12     ` Jeff King
2015-02-12 18:42       ` David Glasser
2015-02-12 20:18   ` Junio C Hamano
2015-02-12 20:53     ` David Glasser
2015-02-12 21:23       ` Junio C Hamano
2015-02-12 22:16         ` David Glasser
2015-02-12 22:19           ` David Glasser
2015-02-12 22:34           ` Junio C Hamano
2015-02-12 22:50             ` Jeff King
2015-02-12 23:32               ` Junio C Hamano [this message]
2015-02-13  7:10                 ` Jeff King
2015-02-13 19:30                   ` Junio C Hamano
2015-02-13 19:55                     ` Jeff King
2015-02-13  0:17             ` David Glasser
2015-02-13  0:21               ` David Glasser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqwq3mogdm.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=glasser@davidglasser$(echo .)net \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox