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>
diff --git a/project.py b/project.py
index 887fe83..07ac092 100644
--- a/project.py
+++ b/project.py
@@ -1107,6 +1107,12 @@
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)