Skip to content

Commit

Permalink
project: run fetch --refetch on unable to not parse commit
Browse files Browse the repository at this point in the history
Similarly to e59e2ae, handle missing
gc'ed commits by running `git fetch --refetch`.

R=jojwang@google.com

Bug: b/360889369
Bug: b/371000949
Change-Id: I108b870b855d3b9f23665afa134c6e35f7cd2830
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/438461
Reviewed-by: Joanna Wang <jojwang@google.com>
Tested-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
  • Loading branch information
sokcevicG authored and LUCI committed Oct 3, 2024
1 parent 621de7e commit cfe3095
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,10 @@ def _RemoteFetch(
# TODO(b/360889369#comment24): git may gc commits incorrectly.
# Until the root cause is fixed, retry fetch with --refetch which
# will bring the repository into a good state.
elif gitcmd.stdout and "could not parse commit" in gitcmd.stdout:
elif gitcmd.stdout and (
"could not parse commit" in gitcmd.stdout
or "unable to parse commit" in gitcmd.stdout
):
cmd.insert(1, "--refetch")
print(
"could not parse commit error, retrying with refetch",
Expand Down

0 comments on commit cfe3095

Please sign in to comment.