From: Junio C Hamano <gitster@pobox.com>
To: David Glasser <glasser@davidglasser.net>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: Keep original author with git merge --squash?
Date: Thu, 12 Feb 2015 13:23:17 -0800 [thread overview]
Message-ID: <xmqq8ug2rfi2.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAN7QDoLKFBCJpFa+QL8dPQtwyAyDNt-ck_sNJ3fS+vTrK_Lg9w@mail.gmail.com> (David Glasser's message of "Thu, 12 Feb 2015 12:53:33 -0800")
David Glasser <glasser@davidglasser.net> writes:
> Well, using -c appears to override SQUASH_MSG entirely; it replaces
> the message as well as the author. Often I do want to make my own
> message based on all the messages provided by the submitter. (And
> typically the branch's tip is the least useful message anyway: it's
> usually something like "respond to code review".)
I wonder if there is a bug in the workflow. Isn't the contributor
forcing more work to the integrator that way and making it a
responsibility of the integrator to squash multiple commits into
one, instead of asking a cleaned-up branch to be merged in the first
place? It is a key to keep your project scalable to push as much
work out of the integrator's plate to the contributors' plates.
But that is an unrelated tangent. Among the ideas floated in the
thread, I tend to like something like what Peff mentioned earlier.
> I assume you are already munging in your editor the template provided by
> "git commit" after the squash? What would be really nice, IMHO, is if
> there was a way to set the author during that edit (e.g., by moving one
> of the "Author:" lines to the top of the file). That would cover your
> use case, I think, and would also be useful in general.
I don't know if the exact solution Peff mentioned is good [*1*], but
being able to do an equivalent of setting --author="<author>" and
"--date=<date>" from the command line inside the log message editor
would be a huge win.
[Footnote]
*1* You would see
gostak: do not distim doshes unconditionally
Usually it is a good idea to let gostak distim doshes,
but it should cause the program segfault when there is
no doshes to be distimmed. Detect this case and error
out.
Signed-off-by: David Glasser <glasser@davidglasser.net>
# Please enter the commit message ...
#
# Author: David Glasser <glasser@davidglasser.net>
# Date: Thu, 12 Feb 2015 04:28:24 -0500
# ...
when you start "git commit --amend" or "git merge --squash", and the
proposal, as I understand it, is to allow you to do this:
From: David Glasser <glasser@davidglasser.net>
Date: Thu, 12 Feb 2015 04:28:24 -0500
gostak: do not distim doshes unconditionally
Usually it is a good idea to let gostak distim doshes,
but it should cause the program segfault when there is
no doshes to be distimmed. Detect this case and error
out.
Signed-off-by: David Glasser <glasser@davidglasser.net>
# Please enter the commit message ...
#
# ...
which is the same format of the _body_ of the message "git am" would
take. The reason I am not so sure about such a change is that
having to move and edit things would be error prone. Some may
forget to do s/Author:/From:/ and we would end up having to support
both. Some existing commit may validly have lines that begin with
these tokens ("git am" does not have such a problem because it is
not the underlying "git commit" or "git commit-tree" that interprets
these in-body headers). Some users may forget to leave a blank line
between the in-body headers and the subject line.
I suspect that it _might_ work better if we always look for the pair
of "# Author: " and "# Date:" lines (taking the commentchar setting
in to account, of course) immediately at the beginning of the
trailing comment block, and if exists, use that to override the
authorship identity. If the user does not do anything when running
"git commit --amend", the resulting commit will get the original
authorship. If the user strips all the lines in the trailing
comment block, we would do the same thing as we have always done and
retain the original authorship.
I dunno.
next prev parent reply other threads:[~2015-02-12 21:23 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 [this message]
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
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=xmqq8ug2rfi2.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=glasser@davidglasser.net \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.