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

Re: [PATCH] rebase -i: clean error message for --continue after failed exec

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 24, 2011, 18:54 UTC
Message-ID
<7vy5yiod1h.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7v62lmps6k.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
>> If after a failed "exec" instruction there are staged changes,...
>
> I have to wonder why whatever "exec" runs is mucking with the index in the
> first place. Shouldn't we forbid it?

I suspect your patch amounts to the same thing of forbidding, but detecting the lack of $author_script feels like it is covering up the symptom and not directly going for the cause of the symptom.

I wonder if doing something like this would be more direct approach to achieve the same thing.

 git-rebase--interactive.sh |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index c6ba7c1..31026dc 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -472,24 +472,31 @@ do_next () {
 		git rev-parse --verify HEAD > "$state_dir"/stopped-sha
 		${SHELL:-@SHELL_PATH@} -c "$rest" # Actual execution
 		status=$?
+		# Run in subshell because require_clean_work_tree can die.
+		dirty=f
+		(require_clean_work_tree "rebase") || dirty=t
 		if test "$status" -ne 0
 		then
 			warn "Execution failed: $rest"
+			test "$dirty" = f ||
+			warn "and made changes to the index and/or the working tree"
+
 			warn "You can fix the problem, and then run"
 			warn
 			warn "	git rebase --continue"
 			warn
 			exit "$status"
 		fi
-		# Run in subshell because require_clean_work_tree can die.
-		if ! (require_clean_work_tree "rebase")
-		then
+		if test "$dirty" = t
+			warn "Execution succeeded: $rest"
+			warn "but left changes to the index and/or the working tree"
 			warn "Commit or stash your changes, and then run"
 			warn
 			warn "	git rebase --continue"
 			warn
 			exit 1
 		fi
+
 		;;
 	*)
 		warn "Unknown command: $command $sha1 $rest"
Previous: Junio C HamanoNext: Matthieu Moy
Message 5 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.