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

rebase -i: Should --continue auto-amend after failed exec?

From
Johannes Sixt <j6t@kdbg.org>
Date
Aug 8, 2011, 21:11 UTC
Message-ID
<4E40511B.7090206@kdbg.org>

If after a failed "exec" instruction there are staged changes, then currently rebase --continue fails with:

.../git-rebase--interactive: line 774: .../.git/rebase-merge/author-script: No such file or directory

But shouldn't this amend the HEAD commit? The documentation is not clear (from git-rebase.txt):

  The interactive rebase will stop when a command fails (i.e. exits with
  non-0 status) to give you an opportunity to fix the problem. You can
  continue with `git rebase --continue`.

This may be interpreted to work like "edit", and IMO would be a very useful modus operandi.

Here is a test case.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 47c8371..2146e47 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -527,6 +527,21 @@ test_expect_success 'auto-amend only edited commits after "edit"' '
 	git rebase --abort
 '
 
+test_expect_failure 'auto-amend after failed "exec"' '
+	test_tick &&
+	test_when_finished "git rebase --abort || :" &&
+	(
+		FAKE_LINES="1 exec_false" &&
+		export FAKE_LINES &&
+		test_must_fail git rebase -i HEAD^
+	) &&
+	echo "edited again" > file7 &&
+	git add file7 &&
+	FAKE_COMMIT_MESSAGE="edited file7 again" git rebase --continue &&
+	actual=$(git show HEAD:file7) &&
+	test "edited again" = "$actual"
+'
+
 test_expect_success 'rebase a detached HEAD' '
 	grandparent=$(git rev-parse HEAD~2) &&
 	git checkout $(git rev-parse HEAD) &&
Next: Matthieu Moy
Message 1 of 9 in “rebase -i: Should --continue auto-amend after failed exec?”
  1. Johannes SixtAug 8, 2011
  2. Matthieu MoyAug 24, 2011
  3. rebase -i: clean error message for --continue after failed execMatthieu Moy, Aug 24, 2011
  4. Junio C HamanoAug 24, 2011
  5. Junio C HamanoAug 24, 2011
  6. Matthieu MoyAug 25, 2011
  7. Johannes SixtAug 25, 2011
  8. Jeff KingAug 24, 2011
  9. Jeff KingAug 24, 2011

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.