git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Phillip Wood <phillip.wood@dunelm.org.uk>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH/RFC] sequencer.c: record revert/cherry-pick commit with trailer lines
Date: Mon, 5 Nov 2018 22:57:14 +0100 (STD)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1811052255080.86@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <CACsJy8CAw6yR5vbsFJbSd+UTR_1UpS=8PP3hEtbSNSi3SkMNag@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3923 bytes --]

Hi,

On Sun, 4 Nov 2018, Duy Nguyen wrote:

> On Sun, Nov 4, 2018 at 5:45 PM Phillip Wood <phillip.wood@talktalk.net> wrote:
> >
> > On 04/11/2018 07:22, Nguyễn Thái Ngọc Duy wrote:
> > > When a commit is reverted (or cherry-picked with -x) we add an English
> > > sentence recording that commit id in the new commit message. Make
> > > these real trailer lines instead so that they are more friendly to
> > > parsers (especially "git interpret-trailers").
> > >
> > > A reverted commit will have a new trailer
> > >
> > >      Revert: <commit-id>
> > >
> > > Similarly a cherry-picked commit with -x will have
> > >
> > >      Cherry-Pick: <commit-id>
> >
> > I think this is a good idea though I wonder if it will break someones
> > script that is looking for the messages generated by -x at the moment.
> 
> It will [1] but I still think it's worth the trouble. The script will
> be less likely to break after, and you can use git-interpret-trailers
> instead of plain grep.

Since this is a wilfull backwards-incompatible patch, it needs to be done
carefully.

I am not enthused by the idea of breaking power users' setups, and I could
imagine that a much better way to do it would be to introduce a config
setting that guards the new behavior, then add a deprecation notice when
-x is used without that config setting, and then let that simmer for a
couple of versions.

Ciao,
Johannes

> 
> [1] https://public-inbox.org/git/20181017143921.GR270328@devbig004.ftw2.facebook.com/
> 
> > > @@ -1758,16 +1757,10 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
> > >               base_label = msg.label;
> > >               next = parent;
> > >               next_label = msg.parent_label;
> > > -             strbuf_addstr(&msgbuf, "Revert \"");
> > > -             strbuf_addstr(&msgbuf, msg.subject);
> > > -             strbuf_addstr(&msgbuf, "\"\n\nThis reverts commit ");
> > > -             strbuf_addstr(&msgbuf, oid_to_hex(&commit->object.oid));
> > > -
> > > -             if (commit->parents && commit->parents->next) {
> > > -                     strbuf_addstr(&msgbuf, ", reversing\nchanges made to ");
> > > -                     strbuf_addstr(&msgbuf, oid_to_hex(&parent->object.oid));
> > > -             }
> >
> > As revert currently records the parent given on the command line when
> > reverting a merge commit it would probably be a good idea to add that
> > either as a separate trailer or to the Revert: trailer and possibly also
> > generate it for cherry picks.
> 
> My mistake. I didn't read carefully and thought it was logging
> commit->parents, which is pointless.
> 
> So what should be the trailer for this (I don't think putting it in
> Revert: is a good idea, too much to parse)? Revert-parent: ?
> Revert-merge: ?
> 
> > > -             strbuf_addstr(&msgbuf, ".\n");
> > > +             strbuf_addf(&msgbuf, "Revert \"%s\"\n\n", msg.subject);
> >
> > If the message already contains trailers then should we just append the
> > Revert trailer those rather than inserting "\n\n"?
> 
> Umm.. but this \n\n is for separating the subject and the body. I
> think we need it anyway, trailer or not.
> 
> > > @@ -1784,9 +1777,8 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
> > >                       strbuf_complete_line(&msgbuf);
> > >                       if (!has_conforming_footer(&msgbuf, NULL, 0))
> > >                               strbuf_addch(&msgbuf, '\n');
> > > -                     strbuf_addstr(&msgbuf, cherry_picked_prefix);
> > > -                     strbuf_addstr(&msgbuf, oid_to_hex(&commit->object.oid));
> > > -                     strbuf_addstr(&msgbuf, ")\n");
> > > +                     strbuf_addf(&msgbuf, "Cherry-Pick: %s\n",
> > > +                                 oid_to_hex(&commit->object.oid));
> 
> I will probably make this "Cherry-picked-from:" to match our S-o-b style.
> -- 
> Duy
> 

  parent reply	other threads:[~2018-11-05 21:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-04  7:22 [PATCH/RFC] sequencer.c: record revert/cherry-pick commit with trailer lines Nguyễn Thái Ngọc Duy
2018-11-04 16:45 ` Phillip Wood
2018-11-04 17:41   ` Duy Nguyen
2018-11-04 21:12     ` Phillip Wood
2018-11-05 21:57     ` Johannes Schindelin [this message]
2018-11-04 18:10 ` [PATCH/RFC v2] " Nguyễn Thái Ngọc Duy
2018-11-04 21:30   ` brian m. carlson
2018-11-05 16:08     ` Duy Nguyen
2018-11-06 17:16   ` [PATCH/RFC] Support --append-trailer in cherry-pick and revert Nguyễn Thái Ngọc Duy
2018-11-06 17:48     ` Ævar Arnfjörð Bjarmason
2018-11-06 22:11       ` Jeff King
2018-11-06 22:29         ` Jeff King
2018-11-07  0:42         ` Junio C Hamano
2018-11-07 15:30         ` Duy Nguyen
2018-11-07 21:02           ` Jeff King
2018-11-08  0:36           ` Junio C Hamano
2018-11-08  1:29             ` Jeff King
2018-11-08  3:34               ` Junio C Hamano
2018-11-07  0:31     ` Junio C Hamano
2018-11-05  0:56 ` [PATCH/RFC] sequencer.c: record revert/cherry-pick commit with trailer lines Junio C Hamano
2018-11-05 16:17   ` Duy Nguyen
2018-11-06  1:44     ` Junio C Hamano
2018-11-06  8:57 ` Ævar Arnfjörð Bjarmason
2018-11-06 16:13   ` Duy Nguyen
2018-11-06 17:44     ` Ævar Arnfjörð Bjarmason

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.1811052255080.86@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).