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

Re: [RFC PATCH] cherry-pick: set default `--mainline` parent to 1

From
Elijah Newren <newren@gmail.com>
Date
Mar 20, 2019, 14:39 UTC
Message-ID
<CABPp-BEe56GFM_2g7EyXmSrULFwRAvSPBomQ66jEQmCs=HhWpg@mail.gmail.com>
In-Reply-To
<871s31vjo7.fsf@javad.com>
On Wed, Mar 20, 2019 at 8:09 AM Sergey Organov <sorganov@gmail.com> wrote:
Show 31 quoted lines
>
> Junio C Hamano <gitster@pobox.com> writes:
>
> [...]
>
> > But I do have a very strong opinion against adding yet another
> > option that takes an optional argument.  If we want to allow
> > cherry-picking a merge commit just as easy as cherrry-picking a
> > single-parent commit, "git cherry-pick -m merge" (assuming 'merge'
> > is the tip of a branch that is a merge commit) that still requires
> > the user to say "-m" is not a good improvement.  We should just
> > accept "git cherry-pick merge" without any "-m" if we want to move
> > in this direction, I would think.
>
> Let's just make '-m 1' the default option indeed. No need for further
> complexities.
>
> Exactly according to what Junio has already said before. Here:
>
> https://public-inbox.org/git/xmqqsh5gt9sm.fsf@gitster-ct.c.googlers.com
>
> Junio wrote:
>
> > Now, it appears, at least to me, that the world pretty much accepted
> > that the first-parent worldview is often very convenient and worth
> > supporting by the tool, so the next logical step might be to set
> > opts->mainline to 1 by default (and allow an explicit "-m $n" from
> > the command line to override it).  But that should happen after this
> > patch lands---it is logically a separate step, I would think.
>
> ... and as that patch already landed...

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. I would much rather they continued to get an error message and then asked other folks for help so that someone can explain to them what they should instead be doing rather than silently changing the current error into an unwanted operation. Granted, the users will at least get a confusing "Merge branch <foo>" commit message for something that isn't a merge, but I don't think the users will notice that either. It just means we've got both confusing and ugly history without the necessary individual commits or with too much having been cherry-picked. If -m 1 is too much to ask people to specify, could we provide some other shorthand? Or at least make a default-off config option people would have to set if they want a cherry-pick of a merge to succeed without specifying -m?

Elijah
Previous: Sergey OrganovNext: Sergey Organov
Message 4 of 23 in “cherry-pick: set default `--mainline` parent to 1”
  1. cherry-pick: set default `--mainline` parent to 1C.J. Jameson, Mar 20, 2019
  2. Junio C HamanoMar 20, 2019
  3. Sergey OrganovMar 20, 2019
  4. Elijah NewrenMar 20, 2019
  5. Sergey OrganovMar 20, 2019
  6. C.J. JamesonMar 21, 2019
  7. Junio C HamanoMar 21, 2019
  8. Junio C HamanoMar 21, 2019
  9. Sergey OrganovMar 21, 2019
  10. Junio C HamanoMar 21, 2019
  11. Sergey OrganovMar 21, 2019
  12. Junio C HamanoMar 21, 2019
  13. Junio C HamanoMar 21, 2019
  14. Sergey OrganovMar 21, 2019
  15. Junio C HamanoMar 22, 2019
  16. Sergey OrganovMar 22, 2019
  17. C.J. JamesonMar 22, 2019
  18. Johannes SchindelinMar 25, 2019
  19. C.J. JamesonMar 25, 2019
  20. Sergey OrganovMar 21, 2019
  21. Johannes SchindelinMar 22, 2019
  22. Johannes SchindelinMar 22, 2019
  23. Duy NguyenMar 20, 2019

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.