From cfe3095e500cef69e312c3b7700d77515070b262 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Wed, 2 Oct 2024 18:05:48 +0000 Subject: [PATCH] project: run fetch --refetch on unable to not parse commit Similarly to e59e2ae757623e64f625a9cdadf1c2010ef82b34, 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 Tested-by: Josip Sokcevic Commit-Queue: Josip Sokcevic --- project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/project.py b/project.py index b281863b..b29e604f 100644 --- a/project.py +++ b/project.py @@ -2664,7 +2664,10 @@ class Project: # 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",