golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.85k stars 17.51k forks source link

x/review/git-codereview: make 'git codereview mail' run 'git push' using --no-follow-tags #41801

Open cespare opened 3 years ago

cespare commented 3 years ago

I have the push.followTags = true option set in my global gitconfig because it's convenient for my typical git workflows on non-Go projects. But it breaks git codereview mail:

$ git mail
remote: Processing changes: refs: 9, done
To https://go.googlesource.com/tools
 ! [remote rejected]   HEAD -> refs/for/master (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.0 -> gopls/v0.1.0 (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.1 -> gopls/v0.1.1 (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.2 -> gopls/v0.1.2 (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.3 -> gopls/v0.1.3 (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.4 -> gopls/v0.1.4 (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.5 -> gopls/v0.1.5 (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.6 -> gopls/v0.1.6 (cannot combine normal pushes and magic pushes)
 ! [remote rejected]   gopls/v0.1.7 -> gopls/v0.1.7 (cannot combine normal pushes and magic pushes)
error: failed to push some refs to 'https://go.googlesource.com/tools'
(running: git push -q origin HEAD:refs/for/master)

Of course, I can set push.followTags = false for all my Go repos on all the machines I use, but it's hard to remember to do that. git-codereview could warn if the option isn't set. But better yet, it could just supply the flag --no-follow-tags to the git push command.

(I didn't check how long the --no-follow-tags flag has existed and whether we need to care about git versions older than that.)

dmitshur commented 3 years ago

CC @rsc, @kevinburke.