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

Re: [PATCH 1/1] rebase -i: introduce the 'break' command

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 5, 2018, 08:15 UTC
Message-ID
<xmqq1s9424ig.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<b358178548bdc9134d4e4b83b1d0384ebb257a72.1538578818.git.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 16 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The 'edit' command can be used to cherry-pick a commit and then
> immediately drop out of the interactive rebase, with exit code 0, to let
> the user amend the commit, or test it, or look around.
>
> Sometimes this functionality would come in handy *without*
> cherry-picking a commit, e.g. to interrupt the interactive rebase even
> before cherry-picking a commit, or immediately after an 'exec' or a
> 'merge'.
>
> This commit introduces that functionality, as the spanking new 'break' command.
>
> Suggested-by: Stefan Beller <sbeller@google.com>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---

If one wants to emulate this with the versions of Git that are currently deployed, would it be sufficient to insert "exec false" instead of "break"?

The reason I am asking is *not* to imply that we do not need this new feature. It is because I vaguely recall seeing a request to add 'pause' to the insn set and "exec false" was mentioned as a more general alternative long time ago. I am trying to see if this is a recurring request/wish, because it would reinforce that this new feature would be a good addition if that is the case.

I suspect that "exec false" would give a message that looks like a complaint ("'false' failed so we are giving you control back to fix things" or something like that), and having a dedicated way to pause the execution without alarming the user is a good idea.

I think the earlier request asked for 'pause' (I didn't dig the list archive very carefully, though), and 'stop' may also be a possible verb, but I tend to agree with this patch that 'break' is probably the best choice, simply because it begins with 'b' in the abbreviated form, a letter that is not yet used by others (unlike 'pause' or 'stop' that would want 'p' and 's' that are already taken)..

Here is a tangent, but I think the description of "-x <cmd>" in "git rebase --continue" should mention that a failing command would interrupt the sequencer. That fact about "exec" command is given much later in the last part of the "interactive mode" section of the manual, so technically our docs are not being incomplete, but the current description is not helpful to those who are looking for substring "exec" from the beginning of the documentation to find out if the exit status of the command affects the way commits are replayed (which is what I was doing when imagining how users would emulate this feature with deployed versions of Git).

Perhaps something as simple as this...
 Documentation/git-rebase.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 0e20a66e73..0fc5a851b5 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -420,7 +420,8 @@ idea unless you know what you are doing (see BUGS below).
 --exec <cmd>::
 	Append "exec <cmd>" after each line creating a commit in the
 	final history. <cmd> will be interpreted as one or more shell
-	commands.
+	commands, and interrupts the rebase session when it exits with
+	non-zero status.
 +
 You may execute several commands by either using one instance of `--exec`
 with several commands:


Also, it seems that this has some interaction with the topics in
flight; the added test does pass when queued on top of 'master', but
fails when merged to 'pu'.  I didn't look into the details as I am
not fully online yet.

Thanks.
Previous: Johannes Schindelin via GitGitGadgetNext: Jacob Keller
Message 3 of 27 in “rebase -i: introduce the 'break' command”
  1. 0/1 rebase -i: introduce the 'break' commandJohannes Schindelin via GitGitGadget, Oct 3, 2018
  2. 1/1 rebase -i: introduce the 'break' commandJohannes Schindelin via GitGitGadget, Oct 3, 2018
  3. Junio C HamanoOct 5, 2018
  4. Jacob KellerOct 5, 2018
  5. Johannes SchindelinOct 5, 2018
  6. Junio C HamanoOct 9, 2018
  7. Junio C HamanoOct 9, 2018
  8. 0/2 rebase -i: introduce the 'break' commandJohannes Schindelin via GitGitGadget, Oct 10, 2018
  9. 1/2 rebase -i: clarify what happens on a failed `exec`Johannes Schindelin via GitGitGadget, Oct 10, 2018
  10. Eric SunshineOct 10, 2018
  11. Junio C HamanoOct 11, 2018
  12. Johannes SchindelinOct 12, 2018
  13. 2/2 rebase -i: introduce the 'break' commandJohannes Schindelin via GitGitGadget, Oct 10, 2018
  14. Phillip WoodOct 11, 2018
  15. Johannes SchindelinOct 12, 2018
  16. Phillip WoodOct 12, 2018
  17. Johannes SchindelinOct 12, 2018
  18. 0/2 rebase -i: introduce the 'break' commandJohannes Schindelin via GitGitGadget, Oct 12, 2018
  19. 1/2 rebase -i: clarify what happens on a failed `exec`Johannes Schindelin via GitGitGadget, Oct 12, 2018
  20. 2/2 rebase -i: introduce the 'break' commandJohannes Schindelin via GitGitGadget, Oct 12, 2018
  21. Junio C HamanoOct 12, 2018
  22. Johannes SchindelinOct 12, 2018
  23. Junio C HamanoOct 12, 2018
  24. Johannes SchindelinOct 12, 2018
  25. 3/2 rebase -i: recognize short commands without argumentsJohannes Sixt, Oct 25, 2018
  26. Junio C HamanoOct 26, 2018
  27. Johannes SchindelinOct 26, 2018

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.