Skip to content
Snippets Groups Projects
Commit a2cd6aea authored by Xin Li's avatar Xin Li
Browse files

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: default avatarMike Frysinger <vapier@google.com>
Tested-by: default avatarXin Li <delphij@google.com>
parent 70d861fa
No related branches found
No related tags found
No related merge requests found
...@@ -2186,12 +2186,15 @@ class Project(object): ...@@ -2186,12 +2186,15 @@ class Project(object):
cmd.append('--update-head-ok') cmd.append('--update-head-ok')
cmd.append(name) cmd.append(name)
spec = []
# If using depth then we should not get all the tags since they may # If using depth then we should not get all the tags since they may
# be outside of the depth. # be outside of the depth.
if no_tags or depth: if no_tags or depth:
cmd.append('--no-tags') cmd.append('--no-tags')
else: else:
cmd.append('--tags') cmd.append('--tags')
spec.append(str((u'+refs/tags/*:') + remote.ToLocal('refs/tags/*')))
if force_sync: if force_sync:
cmd.append('--force') cmd.append('--force')
...@@ -2202,12 +2205,9 @@ class Project(object): ...@@ -2202,12 +2205,9 @@ class Project(object):
if submodules: if submodules:
cmd.append('--recurse-submodules=on-demand') cmd.append('--recurse-submodules=on-demand')
spec = []
if not current_branch_only: if not current_branch_only:
# Fetch whole repo # Fetch whole repo
spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) 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: elif tag_name is not None:
spec.append('tag') spec.append('tag')
spec.append(tag_name) spec.append(tag_name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment