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 <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
May 12, 2013 at 17:26 UTC
a1549e1049439386b9fd643fae236ad3ba649650
2 files changed
+11
-6
git-am.sh
+7
-2
@@ -906,5 +906,10 @@ if test -s "$dotest"/rewritten; then
906
fi
907
fi
908
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
+4
-4
@@ -7,12 +7,12 @@ case "$action" in
7
continue)
8
git am --resolved --resolvemsg="$resolvemsg" &&
9
move_to_original_branch
10
- exit
10
+ return
11
;;
12
skip)
13
git am --skip --resolvemsg="$resolvemsg" &&
14
move_to_original_branch
15
- exit
15
+ return
16
;;
17
esac
18
@@ -56,7 +56,7 @@ else
56
57
As a result, git cannot rebase them.
58
EOF
59
- exit $?
59
+ return $?
60
fi
61
62
git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches"
@@ -68,7 +68,7 @@ fi
68
if test 0 != $ret
69
then
70
test -d "$state_dir" && write_basic_state
71
- exit $ret
71
+ return $ret
72
fi
73
74
move_to_original_branch