summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2019-09-16 10:55:41 -0700
committerXin Li <delphij@google.com>2019-09-16 18:34:45 +0000
commita2cd6aeae8abb6379074964e5d75c1c3b7854bcf (patch)
tree4c3be20b6e08d3811cb3c0b6cfde8dcd3bc0005f
parent70d861fa2938d1f8f84eb8ce76ebc9f719197934 (diff)
downloadgit-repo-a2cd6aeae8abb6379074964e5d75c1c3b7854bcf.tar.gz
Fix tag clobbering when -c is used.v1.13.6
Bug: b/140189154 Change-Id: I8861a6115b20c9a3d88ddec5344c75326ae44823 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/237572 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
-rwxr-xr-xproject.py6
1 files 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):
2186 cmd.append('--update-head-ok') 2186 cmd.append('--update-head-ok')
2187 cmd.append(name) 2187 cmd.append(name)
2188 2188
2189 spec = []
2190
2189 # If using depth then we should not get all the tags since they may 2191 # If using depth then we should not get all the tags since they may
2190 # be outside of the depth. 2192 # be outside of the depth.
2191 if no_tags or depth: 2193 if no_tags or depth:
2192 cmd.append('--no-tags') 2194 cmd.append('--no-tags')
2193 else: 2195 else:
2194 cmd.append('--tags') 2196 cmd.append('--tags')
2197 spec.append(str((u'+refs/tags/*:') + remote.ToLocal('refs/tags/*')))
2195 2198
2196 if force_sync: 2199 if force_sync:
2197 cmd.append('--force') 2200 cmd.append('--force')
@@ -2202,12 +2205,9 @@ class Project(object):
2202 if submodules: 2205 if submodules:
2203 cmd.append('--recurse-submodules=on-demand') 2206 cmd.append('--recurse-submodules=on-demand')
2204 2207
2205 spec = []
2206 if not current_branch_only: 2208 if not current_branch_only:
2207 # Fetch whole repo 2209 # Fetch whole repo
2208 spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) 2210 spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*')))
2209 if not (no_tags or depth):
2210 spec.append(str((u'+refs/tags/*:') + remote.ToLocal('refs/tags/*')))
2211 elif tag_name is not None: 2211 elif tag_name is not None:
2212 spec.append('tag') 2212 spec.append('tag')
2213 spec.append(tag_name) 2213 spec.append(tag_name)