From: Paul Morelle Date: Wed, 28 Nov 2018 13:28:51 GMT Subject: [PATCH] rebase -i: introduce the 'test' command Message-ID: <3fb5a7ff-a63a-6fac-1456-4dbc9135d088@gmail.com> The 'exec' command can be used to run tests on a set of commits, interrupting on failing commits to let the user fix the tests. However, the 'exec' line has been consumed, so it won't be ran again by 'git rebase --continue' is ran, even if the tests weren't fixed. This commit introduces a new command 'test' equivalent to 'exec', except that it is automatically rescheduled in the todo list if it fails. Signed-off-by: Paul Morelle --- Documentation/git-rebase.txt | 9 ++++++--- rebase-interactive.c | 1 + sequencer.c | 23 +++++++++++++++-------- t/lib-rebase.sh | 4 +++- t/t3404-rebase-interactive.sh | 16 ++++++++++++++++ 5 files changed, 41 insertions(+), 12 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 80793bad8..c8f565637 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -693,8 +693,8 @@ $ git rebase -i -p --onto Q O Reordering and editing commits usually creates untested intermediate steps. You may want to check that your history editing did not break anything by running a test, or at least recompiling at intermediate -points in history by using the "exec" command (shortcut "x"). You may -do so by creating a todo list like this one: +points in history by using the "exec" command (shortcut "x") or the +"test" command. You may do so by creating a todo list like this one: ------------------------------------------- pick deadbee Implement feature XXX @@ -702,7 +702,7 @@ fixup f1a5c00 Fix to feature XXX exec make pick c0ffeee The oneline of the next commit edit deadbab The oneline of the commit after -exec cd subdir; make test +test cd subdir; make test ... ------------------------------------------- @@ -715,6 +715,9 @@ in `$SHELL`, or the default shell if `$SHELL` is not set), so you can use shell features (like "cd", ">", ";" ...). The command is run from the root of the working tree. +The "test" command does the same, but will remain in the todo list as +the next command, until it succeeds. + ---------------------------------- $ git rebase -i --exec "make test" ---------------------------------- diff --git a/rebase-interactive.c b/rebase-interactive.c index 78f3263fc..4a408661d 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -14,6 +14,7 @@ void append_todo_help(unsigned edit_todo, unsigned keep_empty, "s, squash = use commit, but meld into previous commit\n" "f, fixup = like \"squash\", but discard this commit's log message\n" "x, exec = run command (the rest of the line) using shell\n" +" test = same as exec command, but keep it in TODO if it fails\n" "b, break = stop here (continue rebase later with 'git rebase --continue')\n" "d, drop = remove commit\n" "l, label