Karthik Nayak <karthik....@gmail.com> writes: > On Tue, Jul 28, 2015 at 6:39 PM, Matthieu Moy > <matthieu....@grenoble-inp.fr> wrote: >> Karthik Nayak <karthik....@gmail.com> writes: >> >>> We check if given ref is the current branch in print_ref_list(). Move >>> this check to print_ref_item() where it is checked right before >>> printing. >> >> This means that the '*' and the different color are coded in C, hence >> it's not possible to mimick this using "git for-each-ref --format ...". >> >> I do not consider this as blocking, but I think the ultimate goal should >> be to allow this, so that all the goodies of "git branch" can be made >> available to other ref-listing commands. >> > > Not sure what you mean here.
What you already know, but probably badly explained ;-). Eventually, the output of "git branch" should correspond to a format string (so git branch would be almost an alias for "git for-each-ref refs/heads/ --format '...'"). Internally, this would mean using show_ref_array_item instead of print_ref_item. This is what you managed to do for "git tag". You already identified one difficulty with sha1 alignment in "git branch -v". I'm pointing out another which is that displaying the "*" in front of the current branch is currently not possible with a format string. You would need an atom like %(displayAStarIfTheBranchIsTheCurrentOne) (for which you'd need to find a short-and-sweet name ;-) ). -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html