"git push origin HEAD:refs/for/master foo:refs/heads/bar": should it work?

220 views
Skip to first unread message

Dave Borowitz

unread,
Aug 7, 2017, 9:01:22 AM8/7/17
to repo-discuss
We would be able to simplify a bunch of code in the server if we could disallow this:
  git push origin HEAD:refs/for/master foo:refs/heads/bar

Specifically, my proposal is to make it so that if a push contains a magic branch (refs/for/*), then that is the *only* ref that is allowed. In other words, allow these:
  git push origin HEAD:refs/for/master
  git push origin foo:refs/heads/bar baz:refs/heads/qux :refs/heads/quux
but don't allow them in a single push.

Would this break anybody? If you do this kind of push, I'd like to hear about your use case.

Note that it is already illegal to have >1 magic ref:
  git push origin HEAD:refs/for/master foo:refs/for/bar

Also, under the current behavior, if you pass a magic ref and also non-magic refs, the order of processing between magic/non-magic refs is undefined.

Shawn Pearce

unread,
Aug 7, 2017, 9:31:46 AM8/7/17
to Dave Borowitz, repo-discuss
The fact this combination has always been undefined behavior makes me want to argue for disallowing the combination in future versions. Users just don't know what they are going to get when they do combinations like that. Especially if they are operating on the same SHA-1s.
Reply all
Reply to author
Forward
0 new messages