Skip to content

Commit

Permalink
rebase: ignore failures from "gc --auto"
Browse files Browse the repository at this point in the history
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jan 13, 2016
1 parent 2435856 commit 8c24f5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-rebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ You can run "git stash pop" or "git stash drop" at any time.

finish_rebase () {
apply_autostash &&
git gc --auto &&
{ git gc --auto || true; } &&
rm -rf "$state_dir"
}

Expand Down

0 comments on commit 8c24f5b

Please sign in to comment.