summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorRobin Schneider <ypid@riseup.net>2021-11-13 22:55:32 +0100
committerRobin Schneider <ypid@riseup.net>2021-11-16 20:43:57 +0000
commit9c1fc5bc5d1e78f7794ae0ddfa379b448fcb4b1f (patch)
tree100ffc8713fb863687b412118ac8091a81fbdfb6 /project.py
parent333c0a499bd76a129dfbb4ba78c182c398caa79f (diff)
downloadgit-repo-9c1fc5bc5d1e78f7794ae0ddfa379b448fcb4b1f.tar.gz
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 <vapier@google.com> Tested-by: Robin Schneider <ypid@riseup.net>
Diffstat (limited to 'project.py')
-rw-r--r--project.py5
1 files changed, 4 insertions, 1 deletions
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):
2044 2044
2045 if current_branch_only: 2045 if current_branch_only:
2046 if self.revisionExpr.startswith(R_TAGS): 2046 if self.revisionExpr.startswith(R_TAGS):
2047 # this is a tag and its sha1 value should never change 2047 # This is a tag and its commit id should never change.
2048 tag_name = self.revisionExpr[len(R_TAGS):] 2048 tag_name = self.revisionExpr[len(R_TAGS):]
2049 elif self.upstream and self.upstream.startswith(R_TAGS):
2050 # This is a tag and its commit id should never change.
2051 tag_name = self.upstream[len(R_TAGS):]
2049 2052
2050 if is_sha1 or tag_name is not None: 2053 if is_sha1 or tag_name is not None:
2051 if self._CheckForImmutableRevision(): 2054 if self._CheckForImmutableRevision():