Skip to content

Commit 8c24f5b

Browse files
peffgitster
authored andcommitted
rebase: ignore failures from "gc --auto"
After rebasing, we call "gc --auto" to clean up if we created a lot of loose objects. However, we do so inside an &&-chain. If "gc --auto" fails (e.g., because a previous background gc blocked us by leaving "gc.log" in place), then: 1. We will fail to clean up the state directory, leaving the user stuck in the rebase forever (even "git am --abort" doesn't work, because it calls "gc --auto"!). 2. In some cases, we may return a bogus exit code from rebase, indicating failure when everything except the auto-gc succeeded. We can fix this by ignoring the exit code of "gc --auto". Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2435856 commit 8c24f5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-rebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ You can run "git stash pop" or "git stash drop" at any time.
176176

177177
finish_rebase () {
178178
apply_autostash &&
179-
git gc --auto &&
179+
{ git gc --auto || true; } &&
180180
rm -rf "$state_dir"
181181
}
182182

0 commit comments

Comments
 (0)