From a2cd6aeae8abb6379074964e5d75c1c3b7854bcf Mon Sep 17 00:00:00 2001 From: Xin Li Date: Mon, 16 Sep 2019 10:55:41 -0700 Subject: [PATCH] Fix tag clobbering when -c is used. Bug: b/140189154 Change-Id: I8861a6115b20c9a3d88ddec5344c75326ae44823 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/237572 Reviewed-by: Mike Frysinger Tested-by: Xin Li --- project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project.py b/project.py index 03a75f49..a20b4134 100755 --- a/project.py +++ b/project.py @@ -2186,12 +2186,15 @@ class Project(object): cmd.append('--update-head-ok') cmd.append(name) + spec = [] + # If using depth then we should not get all the tags since they may # be outside of the depth. if no_tags or depth: cmd.append('--no-tags') else: cmd.append('--tags') + spec.append(str((u'+refs/tags/*:') + remote.ToLocal('refs/tags/*'))) if force_sync: cmd.append('--force') @@ -2202,12 +2205,9 @@ class Project(object): if submodules: cmd.append('--recurse-submodules=on-demand') - spec = [] if not current_branch_only: # Fetch whole repo spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) - if not (no_tags or depth): - spec.append(str((u'+refs/tags/*:') + remote.ToLocal('refs/tags/*'))) elif tag_name is not None: spec.append('tag') spec.append(tag_name)