summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorJosip Sokcevic <sokcevic@chromium.org>2024-09-12 04:32:25 +0000
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-09-12 15:27:12 +0000
commite59e2ae757623e64f625a9cdadf1c2010ef82b34 (patch)
tree101601055a9fe3d72080a7e63a03d0c158914a2c /project.py
parentc44ad093092f71320c6311cc1fc3de9171f6bd0c (diff)
downloadgit-repo-e59e2ae757623e64f625a9cdadf1c2010ef82b34.tar.gz
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/20240802073143.56731-1-hanyang.tony@bytedance.com/ ). 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 <sokcevic@google.com> Reviewed-by: Sam Saccone <samccone@google.com> Tested-by: Josip Sokcevic <sokcevic@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/project.py b/project.py
index 25a8cdcd..27ea748f 100644
--- a/project.py
+++ b/project.py
@@ -2659,6 +2659,17 @@ class Project:
2659 # Fallthru to sleep+retry logic at the bottom. 2659 # Fallthru to sleep+retry logic at the bottom.
2660 pass 2660 pass
2661 2661
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
2662 # Try to prune remote branches once in case there are conflicts. 2673 # Try to prune remote branches once in case there are conflicts.
2663 # For example, if the remote had refs/heads/upstream, but deleted 2674 # For example, if the remote had refs/heads/upstream, but deleted
2664 # that and now has refs/heads/upstream/foo. 2675 # that and now has refs/heads/upstream/foo.