summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git-rebase--interactive.sh10
-rwxr-xr-xt/t5407-post-rewrite-hook.sh2
2 files changed, 6 insertions, 6 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index f267d8b6c3..9d413cbc12 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -486,7 +486,7 @@ do_pick () {
}
do_next () {
- rm -f "$msg" "$author_script" "$amend" || exit
+ rm -f "$msg" "$author_script" "$amend" "$state_dir"/stopped-sha || exit
read -r command sha1 rest < "$todo"
case "$command" in
"$comment_char"*|''|noop)
@@ -576,9 +576,6 @@ do_next () {
read -r command rest < "$todo"
mark_action_done
printf 'Executing: %s\n' "$rest"
- # "exec" command doesn't take a sha1 in the todo-list.
- # => can't just use $sha1 here.
- 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.
@@ -874,7 +871,10 @@ first and then run 'git rebase --continue' again."
fi
fi
- record_in_rewritten "$(cat "$state_dir"/stopped-sha)"
+ if test -r "$state_dir"/stopped-sha
+ then
+ record_in_rewritten "$(cat "$state_dir"/stopped-sha)"
+ fi
require_clean_work_tree "rebase"
do_rest
diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh
index 53a40622a7..06ffad6a28 100755
--- a/t/t5407-post-rewrite-hook.sh
+++ b/t/t5407-post-rewrite-hook.sh
@@ -212,7 +212,7 @@ EOF
verify_hook_input
'
-test_expect_failure 'git rebase -i (exec)' '
+test_expect_success 'git rebase -i (exec)' '
git reset --hard D &&
clear_hook_input &&
FAKE_LINES="edit 1 exec_false 2" git rebase -i B &&