From 99ebf627dbf50ea18935a3ab59e3c51fb41b7f77 Mon Sep 17 00:00:00 2001 From: Aravind Vasudevan Date: Tue, 4 Apr 2023 23:44:37 +0000 Subject: [PATCH] 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 Reviewed-by: Mike Frysinger Commit-Queue: Aravind Vasudevan --- project.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project.py b/project.py index 887fe83a..07ac0925 100644 --- a/project.py +++ b/project.py @@ -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)