From 8e983bbc0f5f48aa38d0e1c5a37766ce121d28eb Mon Sep 17 00:00:00 2001 From: Xin Li Date: Tue, 20 Jul 2021 20:15:30 +0000 Subject: [PATCH] Force a fetch when superproject has a newer SHA1 for remote branch. For older git-repo versions, we might have only fetched the SHA1 revision that was provided by the project, but have remote branch left intact as long as they exist. When the remote branch become stale, some repo operations like rebase would fail, and repo sync would not correct this situation. Fix this by tightening the requirement to also require the superproject provided SHA1 be an ancestor or equal to the tip-of-tree of the remote branch. Bug: [google internal] b/193798453 Change-Id: Ie34c5d860dabb1cbd9f822da929088ec69c79cf6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312642 Tested-by: Xin Li Reviewed-by: Raman Tenneti --- project.py | 1 + 1 file changed, 1 insertion(+) diff --git a/project.py b/project.py index e777dbd..a55e760 100644 --- a/project.py +++ b/project.py @@ -1971,6 +1971,7 @@ class Project(object): rev = self.GetRemote(self.remote.name).ToLocal(self.upstream) self.bare_git.rev_list('-1', '--missing=allow-any', '%s^0' % rev, '--') + self.bare_git.merge_base('--is-ancestor', self.revisionExpr, rev) return True except GitError: # There is no such persistent revision. We have to fetch it.