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
Junio C Hamano <gitster@pobox.com>
Date
Mar 21, 2019, 02:17 UTC
Message-ID
<xmqqd0mlt1h1.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CABPp-BEe56GFM_2g7EyXmSrULFwRAvSPBomQ66jEQmCs=HhWpg@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 6 quoted lines
> 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".

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.

Previous: C.J. JamesonNext: Junio C Hamano
Message 7 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.