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"