Skip to content

Commit e59e2ae

Browse files
sokcevicGLUCI
authored andcommitted
project: run fetch --refetch onacould not parse commit
git may gc reachable objects in partial clone repository due to a bug (report: https://lore.kernel.org/git/[email protected]/ ). Until git is properly patched and released, force --refetch iff "could not parse commit" is part of git output. --refetch will will ensure that gc'ed objects are retrieved. Bug: b/360889369 Change-Id: I0fc911c591060f859235dcd8d019881106f0858e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/437017 Commit-Queue: Josip Sokcevic <[email protected]> Reviewed-by: Sam Saccone <[email protected]> Tested-by: Josip Sokcevic <[email protected]>
1 parent c44ad09 commit e59e2ae

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

project.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,6 +2659,17 @@ def _RemoteFetch(
26592659
# Fallthru to sleep+retry logic at the bottom.
26602660
pass
26612661

2662+
# TODO(b/360889369#comment24): git may gc commits incorrectly.
2663+
# Until the root cause is fixed, retry fetch with --refetch which
2664+
# will bring the repository into a good state.
2665+
elif gitcmd.stdout and "could not parse commit" in gitcmd.stdout:
2666+
cmd.insert(1, "--refetch")
2667+
print(
2668+
"could not parse commit error, retrying with refetch",
2669+
file=output_redir,
2670+
)
2671+
continue
2672+
26622673
# Try to prune remote branches once in case there are conflicts.
26632674
# For example, if the remote had refs/heads/upstream, but deleted
26642675
# that and now has refs/heads/upstream/foo.

0 commit comments

Comments
 (0)