Skip to content

Commit a1549e1

Browse files
artagnongitster
authored andcommitted
am: return control to caller, for housekeeping
We only need to do these two tasks git gc --auto rm -fr "$dotest" ourselves if the script was invoked as a standalone program; when invoked with --rebasing (from git-rebase--am.sh), cascade control back to the ultimate caller git-rebase.sh to do this for us. Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f5f758a commit a1549e1

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

git-am.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,5 +906,10 @@ if test -s "$dotest"/rewritten; then
906906
fi
907907
fi
908908

909-
rm -fr "$dotest"
910-
git gc --auto
909+
# If am was called with --rebasing (from git-rebase--am), it's up to
910+
# the caller to take care of housekeeping.
911+
if ! test -f "$dotest/rebasing"
912+
then
913+
rm -fr "$dotest"
914+
git gc --auto
915+
fi

git-rebase--am.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ case "$action" in
77
continue)
88
git am --resolved --resolvemsg="$resolvemsg" &&
99
move_to_original_branch
10-
exit
10+
return
1111
;;
1212
skip)
1313
git am --skip --resolvemsg="$resolvemsg" &&
1414
move_to_original_branch
15-
exit
15+
return
1616
;;
1717
esac
1818

@@ -56,7 +56,7 @@ else
5656
5757
As a result, git cannot rebase them.
5858
EOF
59-
exit $?
59+
return $?
6060
fi
6161

6262
git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches"
@@ -68,7 +68,7 @@ fi
6868
if test 0 != $ret
6969
then
7070
test -d "$state_dir" && write_basic_state
71-
exit $ret
71+
return $ret
7272
fi
7373

7474
move_to_original_branch

0 commit comments

Comments
 (0)