pub fn run(refs: &[PushRef], args: &[OsString]) -> OutcomeExpand description
Judged on the REFS BEING PUSHED, not on the branch that happens to be checked out.
It used to ask rev-parse --abbrev-ref HEAD, exactly the mistake
branch_protect documents avoiding, and it cost two things:
git push origin local:refs/heads/othervalidated the wrong name entirely — the one you are standing on rather than the one being created;- on a DETACHED HEAD,
--abbrev-ref HEADreturns the literal string"HEAD", whichconformsrejects. Theshow-branch remotes/origin/HEADshort-circuit hid that in a normal clone, but in a repository with norefs/remotes/origin/HEAD— a baregit initplusgit remote add, or aftergit remote set-head --delete— a perfectly ordinarygit push origin HEAD:refs/heads/feat/xwas BLOCKED.
The show-branch probe is gone, replaced by the non-zero remote oid: git
has already told us whether the branch exists on the server, and the probe
depended on a remote-tracking ref that a fresh clone may not have.