diff --git a/git-am.sh b/git-am.sh index ccb854a20e51d2..1cf3d1dacfb208 100755 --- a/git-am.sh +++ b/git-am.sh @@ -906,5 +906,10 @@ if test -s "$dotest"/rewritten; then fi fi -rm -fr "$dotest" -git gc --auto +# If am was called with --rebasing (from git-rebase--am), it's up to +# the caller to take care of housekeeping. +if ! test -f "$dotest/rebasing" +then + rm -fr "$dotest" + git gc --auto +fi diff --git a/git-rebase--am.sh b/git-rebase--am.sh index f84854f09a14b9..34e3102fcbfa64 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -7,12 +7,12 @@ case "$action" in continue) git am --resolved --resolvemsg="$resolvemsg" && move_to_original_branch - exit + return ;; skip) git am --skip --resolvemsg="$resolvemsg" && move_to_original_branch - exit + return ;; esac @@ -56,7 +56,7 @@ else As a result, git cannot rebase them. EOF - exit $? + return $? fi git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches" @@ -68,7 +68,7 @@ fi if test 0 != $ret then test -d "$state_dir" && write_basic_state - exit $ret + return $ret fi move_to_original_branch