Skip to content

Commit f5f758a

Browse files
artagnongitster
authored andcommitted
rebase: prepare to do generic housekeeping
On successful completion of a rebase in git-rebase--$backend.sh, the $backend script cleans up on its own and exits. The cleanup routine is however, independent of the $backend, and each $backend script unnecessarily duplicates this work: rm -rf "$state_dir" git gc --auto Prepare git-rebase.sh for later patches that return control from each $backend script back to us, for performing this generic cleanup routine. The code that this patch adds is currently unreachable, and will only start to be used when git-rebase--$backend.sh scripts are taught to return control in later patches. Another advantage is that git-rebase.sh can implement a generic finish_rebase() to possibly do additional tasks in addition to the cleanup. Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1224f3d commit f5f758a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

git-rebase.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ run_specific_rebase () {
150150
autosquash=
151151
fi
152152
. git-rebase--$type
153+
ret=$?
154+
if test $ret -eq 0
155+
then
156+
git gc --auto &&
157+
rm -rf "$state_dir"
158+
fi
159+
exit $ret
153160
}
154161

155162
run_pre_rebase_hook () {

0 commit comments

Comments
 (0)