[PATCH v2 0/3] Towards a useable git-branch
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- May 24, 2013, 14:19 UTC
- Message-ID
- <1369405177-7855-1-git-send-email-artagnon@gmail.com>
So, while investigating alignment operators in pretty-formats, I found out that it's way too much effort and totally not worth it (atleast not immediately; we can add it later if we want). What I want now is a useable git-branch output. And I think I can say that I've achieved it.
I currently have hot aliased to
for-each-ref --format='%C(red)%(HEAD)%C(reset) %C(green)%(refname:short)%C(reset)%(upstream:trackshort)' --count 10 --sort='-committerdate' refs/heads
and it works beautifully for me. Sample output:
% git hot * hot-branch<> pickaxe-doc> publish-rev= publish-rev-test upstream-error= push-current-head= master= prompt= autostash-stash= rebase.autostash=
The asterisk is red, the branch names are in green, and the tracking marker is white.
I'm very happy with the implementation too:
1. color only kicks in at the parsing layer. 2. HEAD is a new atom. 3. :track[short] is a formatp like :short.
There is no need to use a hammer and coerce everything into an atom, or throw everything out the window and start from scratch to conform to pretty-formats perfectly. Let's extend the existing format to be _useful_ sensibly.
Thanks.
Ramkumar Ramachandra (3): for-each-ref: introduce %C(...) for color for-each-ref: introduce %(HEAD) marker for-each-ref: introduce %(upstream:track[short])
builtin/for-each-ref.c | 81 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 8 deletions(-)
-- 1.8.3.rc3.2.g99b8f3f.dirty