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

Re: [PATCH] rebase -i: improve error message when picking merge

From
Rubén Justo <rjusto@gmail.com>
Date
Apr 4, 2024, 19:44 UTC
Message-ID
<57462d2e-e255-4d35-b778-176f03675df0@gmail.com>
In-Reply-To
<pull.1672.git.1708945087691.gitgitgadget@gmail.com>
On Mon, Feb 26, 2024 at 10:58:07AM +0000, Phillip Wood via GitGitGadget wrote:
Show 32 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
> 
> The only todo commands that accept a merge commit are "merge" and
> "reset". All the other commands like "pick" or "reword" fail when they
> try to pick a a merge commit and print the message
> 
>     error: commit abc123 is a merge but no -m option was given.
> 
> followed by a hint about the command being rescheduled. This message is
> designed to help the user when they cherry-pick a merge and forget to
> pass "-m". For users who are rebasing the message is confusing as there
> is no way for rebase to cherry-pick the merge.
> 
> Improve the user experience by detecting the error when the todo list is
> parsed rather than waiting for the "pick" command to fail and print a
> message recommending the "merge" command instead. We recommend "merge"
> rather than "exec git cherry-pick -m ..." on the assumption that
> cherry-picking merges is relatively rare and it is more likely that the
> user chose "pick" by a mistake.
> 
> It would be possible to support cherry-picking merges by allowing the
> user to pass "-m" to "pick" commands but that adds complexity to do
> something that can already be achieved with
> 
>     exec git cherry-pick -m1 abc123
> 
> The change is relatively straight forward but is complicated slightly as
> we now need to tell the parser if we're rebasing or not.
> 
> Reported-by: Stefan Haller <lists@haller-berlin.de>
> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> ---
Hi Phillip.
The change makes sense, but this is confusing to me:
With this ...
	$ GIT_EDITOR='echo pick 17381ab62a >' ./git rebase -i HEAD
	error: 'pick' does not accept merge commits, please use 'merge -C'
	error: invalid line 1: pick 17381ab62a
	You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.
	Or you can abort the rebase with 'git rebase --abort'.
... I find these repeated messages confusing:
	$ GIT_EDITOR=: ./git rebase --edit-todo
	error: 'pick' does not accept merge commits, please use 'merge -C'
	error: invalid line 1: pick 17381ab62a
	error: 'pick' does not accept merge commits, please use 'merge -C'
	error: invalid line 1: pick 17381ab62a
	You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.
	Or you can abort the rebase with 'git rebase --abort'.
Previous: phillip.wood123@gmail.comNext: phillip.wood123@gmail.com
Message 6 of 26 in “rebase -i: improve error message when picking merge”
  1. rebase -i: improve error message when picking mergePhillip Wood via GitGitGadget, Feb 26, 2024
  2. phillip.wood123@gmail.comApr 3, 2024
  3. Patrick SteinhardtApr 4, 2024
  4. Patrick SteinhardtApr 4, 2024
  5. phillip.wood123@gmail.comApr 4, 2024
  6. Rubén JustoApr 4, 2024
  7. phillip.wood123@gmail.comApr 5, 2024
  8. Rubén JustoApr 6, 2024
  9. phillip.wood123@gmail.comApr 7, 2024
  10. 0/2 rebase -i: improve error message when picking mergePhillip Wood via GitGitGadget, Apr 8, 2024
  11. 1/2 rebase -i: pass struct replay_opts to parse_insn_line()Phillip Wood via GitGitGadget, Apr 8, 2024
  12. Patrick SteinhardtApr 9, 2024
  13. 2/2 rebase -i: improve error message when picking mergePhillip Wood via GitGitGadget, Apr 8, 2024
  14. Junio C HamanoApr 8, 2024
  15. Patrick SteinhardtApr 9, 2024
  16. Junio C HamanoApr 9, 2024
  17. Patrick SteinhardtApr 9, 2024
  18. Phillip WoodApr 9, 2024
  19. Junio C HamanoApr 9, 2024
  20. Phillip WoodApr 12, 2024
  21. 0/2 rebase -i: improve error message when picking mergePhillip Wood via GitGitGadget, May 30, 2024
  22. 1/2 rebase -i: pass struct replay_opts to parse_insn_line()Phillip Wood via GitGitGadget, May 30, 2024
  23. 2/2 rebase -i: improve error message when picking mergePhillip Wood via GitGitGadget, May 30, 2024
  24. Junio C HamanoMay 30, 2024
  25. Phillip WoodJun 3, 2024
  26. Junio C HamanoJun 3, 2024

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.