From 9c1fc5bc5d1e78f7794ae0ddfa379b448fcb4b1f Mon Sep 17 00:00:00 2001 From: Robin Schneider Date: Sat, 13 Nov 2021 22:55:32 +0100 Subject: [PATCH] sync: Handle tag ref in "upstream" field repo sync only handles a git tag properly when it is in the "revision" field. However, "revision locked manifests" (`repo manifest --revision-as-HEAD`) specifies the tag in the "upstream" field. The issue is that this tag is not fetched. Only the commit that the tag points to is fetched. This cases issues as self._CheckForImmutableRevision() runs and comes to the conclusion that the tag was changed while in fact, it was just not fetched. This causes a full sync. File docs/manifest-format.md, section Element-project: > Attribute upstream: Name of the Git ref in which a sha1 can be found. Used when syncing a revision locked manifest in -c mode to avoid having to sync the entire ref space. Project elements not setting their own upstream will inherit this value. Change-Id: I0507d3a5f30aee8920a9f820bafedb48dd5db554 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/323620 Reviewed-by: Mike Frysinger Tested-by: Robin Schneider --- project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/project.py b/project.py index 57826a17..4b85bb98 100644 --- a/project.py +++ b/project.py @@ -2044,8 +2044,11 @@ class Project(object): if current_branch_only: if self.revisionExpr.startswith(R_TAGS): - # this is a tag and its sha1 value should never change + # This is a tag and its commit id should never change. tag_name = self.revisionExpr[len(R_TAGS):] + elif self.upstream and self.upstream.startswith(R_TAGS): + # This is a tag and its commit id should never change. + tag_name = self.upstream[len(R_TAGS):] if is_sha1 or tag_name is not None: if self._CheckForImmutableRevision():