Minimize reliance on 'git branch' output format
Ref T5554. Both the current branch name (if on a branch), as well as the
list of all local branches, can be retrieved without having to parse the
output from "git branch".
Unfortunately, there seems to be no git plumbing for "get list of
branches containing this commit" yet.
For that case, this commit whitelists the output from "git branch" using
the known valid branch names from "git for-each-ref".
Set up a test repo with this structure:
| * Commit B1, on branch "subfeature" | / | * Commit A1, on branch "feature" |/ * Commit M1, on branch "master" |
In subfeature, I tried:
- arc which --base 'git:branch-unique(master)'
- arc feature
After that, I detached my HEAD (don't worry, I got better) and tried again.
Nothing looked broken.
(Tested with git 220.127.116.11 and 2.5.0.)
Reviewers: Blessed Reviewers, epriestley
Reviewed By: Blessed Reviewers, epriestley
Maniphest Tasks: T5554
Differential Revision: https://secure.phabricator.com/D13989