On a successful interactive rebase, git-rebase--interactive.sh
currently cleans up and exits on its own.  Instead of doing these
two things ourselves:

    rm -fr "$dotest"
    git gc --auto

let us return control to the caller (git-rebase.sh), to do the
needful.  The advantage of doing this is that the caller can implement
a generic cleanup routine (and possibly other things) independent of
specific rebases.

Signed-off-by: Ramkumar Ramachandra <artag...@gmail.com>
---
 git-rebase--interactive.sh | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index cc3a9a7..9514e31 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -597,7 +597,7 @@ do_next () {
                fi
                ;;
        esac
-       test -s "$todo" && return
+       test -s "$todo" && return 1
 
        comment_for_reflog finish &&
        newhead=$(git rev-parse HEAD) &&
@@ -623,17 +623,15 @@ do_next () {
                "$GIT_DIR"/hooks/post-rewrite rebase < "$rewritten_list"
                true # we don't care if this hook failed
        fi &&
-       rm -rf "$state_dir" &&
-       git gc --auto &&
        warn "Successfully rebased and updated $head_name."
 
-       exit
+       return 0
 }
 
 do_rest () {
        while :
        do
-               do_next
+               do_next && break
        done
 }
 
@@ -799,12 +797,12 @@ first and then run 'git rebase --continue' again."
        record_in_rewritten "$(cat "$state_dir"/stopped-sha)"
 
        require_clean_work_tree "rebase"
-       do_rest
+       do_rest && return 0
        ;;
 skip)
        git rerere clear
 
-       do_rest
+       do_rest && return 0
        ;;
 edit-todo)
        git stripspace --strip-comments <"$todo" >"$todo".new
-- 
1.8.2.1.578.ga933817

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to