rebase -i: notice and warn if "exec $cmd" modifies the index or the working 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>
Junio C Hamano committed
Aug 24, 2011 at 11:54 UTC
1686519a0854ec09ee1cdd6db7f570ea4590dfce
1 file changed
+9
-3
git-rebase--interactive.sh
+9
-3
@@ -472,18 +472,24 @@ do_next () {
472
git rev-parse --verify HEAD > "$state_dir"/stopped-sha
473
${SHELL:-@SHELL_PATH@} -c "$rest" # Actual execution
474
status=$?
475
+ # Run in subshell because require_clean_work_tree can die.
476
+ dirty=f
477
+ (require_clean_work_tree "rebase" 2>/dev/null) || dirty=t
478
if test "$status" -ne 0
479
then
480
warn "Execution failed: $rest"
481
+ test "$dirty" = f ||
482
+ warn "and made changes to the index and/or the working tree"
483
+
484
warn "You can fix the problem, and then run"
485
warn
486
warn " git rebase --continue"
487
warn
488
exit "$status"
483
- fi
484
- # Run in subshell because require_clean_work_tree can die.
485
- if ! (require_clean_work_tree "rebase")
489
+ elif test "$dirty" = t
490
then
491
+ warn "Execution succeeded: $rest"
492
+ warn "but left changes to the index and/or the working tree"
493
warn "Commit or stash your changes, and then run"
494
warn
495
warn " git rebase --continue"