Home GnuPG

Minimize reliance on 'git branch' output format
46009145f75dUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Minimize reliance on 'git branch' output format

Summary:
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.
(see http://marc.info/?l=git&m=141408477614635&w=2)

For that case, this commit whitelists the output from "git branch" using
the known valid branch names from "git for-each-ref".

Test Plan:
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 1.7.2.5 and 2.5.0.)

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T5554

Differential Revision: https://secure.phabricator.com/D13989

Details

Provenance
Javier Arteaga <code@jbeta.is>Authored on Aug 25 2015, 2:57 AM
epriestley <git@epriestley.com>Committed on Aug 25 2015, 2:57 AM
Parents
rARC6ecb3fb87d2b: Avoid parsing git "remote show" using "ls-remote"
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rARC46009145f75d: Minimize reliance on 'git branch' output format (authored by Javier Arteaga <code@jbeta.is>).Aug 25 2015, 2:57 AM