upload: Add --no-follow-tags by default to git push

Gerrit does not accept pushing git tags to CLs. Hence, this change disables push.followTags for repo upload.

Fixed: b/155095555
Change-Id: I8d99eac29c0b4b375bdb857ed063914441026fa1
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/367736
Tested-by: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
This commit is contained in:
Aravind Vasudevan 2023-04-04 23:44:37 +00:00 committed by LUCI
parent 57cb42861d
commit 99ebf627db

View File

@ -1107,6 +1107,12 @@ class Project(object):
if url.startswith("ssh://"):
cmd.append("--receive-pack=gerrit receive-pack")
# This stops git from pushing all reachable annotated tags when
# push.followTags is configured. Gerrit does not accept any tags
# pushed to a CL.
if git_require((1, 8, 3)):
cmd.append("--no-follow-tags")
for push_option in push_options or []:
cmd.append("-o")
cmd.append(push_option)