We discovered this while working on https://github.com/desktop/desktop/pull/3602.
We currently get the remote name for a branch by parsing its full ref name with a regex. That regex assumes the remote does not contain a slash:
But remote names can totally contain a slash.
The good news is that in Git 2.16, git for-each-ref
has learned how to tell us the remote name. See https://github.com/git/git/blob/52015aaf9d19c97b52c47c7046058e6d029ff856/Documentation/RelNotes/2.16.0.txt#L50-L53. The bad news is that Git 2.16 isn't out yet. So we'll have to wait to fix this.
This actually has a body now 馃檲
FYI: [email protected]
with Git 2.16.0-rc0
is available if you want to start testing out the new version of git for-each-ref
I had a look into this, and we're still reliant for this parsing in git status --branch
. We do this for loading the current remote inside GitStore
, which then flows through to push/pull operations (maybe we can break this? I'm not sure):
~/src/desktop/ git status --branch --porcelain=2
# branch.oid 86edf4c6e1198b19dac474adafe314931097dbdd
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
I'll see if there's a discussion about this elsewhere, otherwise I might brave the Git mailing list and see if they're receptive to applying the same changes here.
Most helpful comment
I had a look into this, and we're still reliant for this parsing in
git status --branch
. We do this for loading the current remote insideGitStore
, which then flows through to push/pull operations (maybe we can break this? I'm not sure):I'll see if there's a discussion about this elsewhere, otherwise I might brave the Git mailing list and see if they're receptive to applying the same changes here.