git-p4: add config git-p4.pathEncoding
[gitweb.git] / git-rebase--interactive.sh
index 00080572529ae4c7e0c86c0aa2ba7cb83146dd2a..5ff0f1c81ac8e72ce6a2358ca2fced0650571030 100644 (file)
@@ -502,7 +502,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)
@@ -592,9 +592,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.
@@ -658,9 +655,9 @@ do_next () {
                git notes copy --for-rewrite=rebase < "$rewritten_list" ||
                true # we don't care if this copying failed
        } &&
-       if test -x "$GIT_DIR"/hooks/post-rewrite &&
-               test -s "$rewritten_list"; then
-               "$GIT_DIR"/hooks/post-rewrite rebase < "$rewritten_list"
+       hook="$(git rev-parse --git-path hooks/post-rewrite)"
+       if test -x "$hook" && test -s "$rewritten_list"; then
+               "$hook" rebase < "$rewritten_list"
                true # we don't care if this hook failed
        fi &&
        warn "Successfully rebased and updated $head_name."
@@ -852,7 +849,11 @@ continue)
        # do we have anything to commit?
        if git diff-index --cached --quiet HEAD --
        then
-               : Nothing to commit -- skip this
+               # Nothing to commit -- skip this commit
+
+               test ! -f "$GIT_DIR"/CHERRY_PICK_HEAD ||
+               rm "$GIT_DIR"/CHERRY_PICK_HEAD ||
+               die "Could not remove CHERRY_PICK_HEAD"
        else
                if ! test -f "$author_script"
                then
@@ -890,7 +891,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