Skip to content

Commit

Permalink
rebase -i: notice and warn if "exec $cmd" modifies the index or the w…
Browse files Browse the repository at this point in the history
…orking tree

If "exec $cmd" touched the index or the working tree, and exited with
non-zero status, the code did not check and warn that there now are
uncommitted changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Aug 26, 2011
1 parent ffaaed8 commit 1686519
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -472,18 +472,24 @@ 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" 2>/dev/null) || 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")
elif test "$dirty" = t
then
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"
Expand Down

0 comments on commit 1686519

Please sign in to comment.