All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Elijah Newren <newren@gmail.com>,
	Sergey Organov <sorganov@gmail.com>,
	"C.J. Jameson" <cjcjameson@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [RFC PATCH] cherry-pick: set default `--mainline` parent to 1
Date: Fri, 22 Mar 2019 11:23:23 +0100 (STD)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1903221116530.41@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <xmqqd0mlt1h1.fsf@gitster-ct.c.googlers.com>

Hi Junio,

On Thu, 21 Mar 2019, Junio C Hamano wrote:

> Elijah Newren <newren@gmail.com> writes:
>
> > This worries me that it'll lead to bad surprises.  Perhaps some folks
> > cherry-pick merges around intentionally, but I would want that to be a
> > rare occurrence at most.  There are lots of folks at $DAYJOB that
> > cherry-pick things, not all of them are expert git-users, and I am
> > certain several have erroneously attempted to cherry-pick merges
> > before.
>
> It was a lot simpler back when "git cherry-pick" did not accept
> ranges.  You are either knowingly cherry-picking a merge, or doing
> so by mistake, and because the command rejected cherry-picking a
> merge without being told with "-m $n" which parent the mainline is
> by default, we are assured that the user knew that s/he was picking
> a merge commit when we saw "-m $n".

Indeed.

> It's not so simple in the world after we started allowing picks of a
> range.  "cherry-pick -m1 A..B" did not work when the range A..B is a
> mixture of merges and non-merges (which is the case 100% of the
> time), as the command used to error out when given the -m option for
> a single-parent commit.  Earlier we said that "as long as the $n
> does not exceed the number of actual parents, let's allow '-m $n'
> even for non-merge commits." to fix it.
>
> We can just reject this RFC patch and we'd be in a slightly safer
> place.  You still need to tell us with "-m 1" on the command line
> that you are picking a range with merges in it.  But then I am sure
> that clueless people blindly would alias "pick = cherry-pick -m1" and
> use "git pick" and blindly pick ranges here and there, so I am not
> sure such a slightly-more safety buys us very much.

It gets even better.

Recently, I found myself wishing for the equivalent of `--rebase-merges`
in `git cherry-pick`. In other words, I wanted to transplant some commits
(including merge commits) from a different branch onto the current branch.

Currently, I work around this by this kind of dance:

	$ git checkout B^0
	$ git rebase -ir --onto HEAD@{1} A
	$ git checkout @{-1}
	$ git merge --ff-only HEAD@{1}

which does work, but it changes the worktree quite a bit (often causing
complete rebuilds due to "changed" header files, when those rebuilds were
not actually necessary).

It also has the rather real downside of not mixing well with an
already-running rebase...

And with that use case in mind, I think that making the `-m 1` option the
default is even less desirable than I thought before.

Ciao,
Dscho

  parent reply	other threads:[~2019-03-22 10:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  3:54 [RFC PATCH] cherry-pick: set default `--mainline` parent to 1 C.J. Jameson
2019-03-20  4:45 ` Junio C Hamano
2019-03-20 12:01   ` Sergey Organov
2019-03-20 14:39     ` Elijah Newren
2019-03-20 15:59       ` Sergey Organov
2019-03-21  1:51         ` C.J. Jameson
2019-03-21  2:17       ` Junio C Hamano
2019-03-21  3:15         ` Junio C Hamano
2019-03-21  5:40           ` Sergey Organov
2019-03-21  5:47             ` Junio C Hamano
2019-03-21  6:12               ` Sergey Organov
2019-03-21  8:31                 ` Junio C Hamano
2019-03-21  8:31                 ` Junio C Hamano
2019-03-21 11:59                   ` Sergey Organov
2019-03-22  2:24                     ` Junio C Hamano
2019-03-22 15:22                       ` Sergey Organov
2019-03-22 18:27                         ` C.J. Jameson
2019-03-25 14:55                           ` Johannes Schindelin
2019-03-25 15:41                             ` C.J. Jameson
2019-03-21  6:54               ` Sergey Organov
2019-03-22 10:23         ` Johannes Schindelin [this message]
2019-03-22 10:13       ` Johannes Schindelin
2019-03-20  9:44 ` Duy Nguyen

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=nycvar.QRO.7.76.6.1903221116530.41@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=cjcjameson@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=sorganov@gmail.com \
    /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.