Re: [PATCH] for-each-ref: introduce color format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 17, 2013 at 9:55 PM, Ramkumar Ramachandra
<artagnon@xxxxxxxxx> wrote:
> You can now do something like
>
> $ git for-each-ref --format='%C(red)%(refname:short)%C(reset)
> %C(blue)%(upstream:diff)%C(reset)' --count 5 --sort='-committerdate'
> refs/heads
>
> To get output that's much more customizable 'git branch' output.  Future
> patches will attempt unify the semantics of 'git branch' and 'git
> for-each-ref'.
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx>
> ---
>  So my evil plan is to keep extending this format until it's on par
>  with pretty-formats.  Then, we can move towards unifying 'git branch'
>  and 'git for-each-ref'.  This will involve deprecating badly
>  thought-out options like '-v', and replacing it with the more
>  powerful '--format'.
>
>  I just have one major doubt: in the above output, how do I align all
>  the upstream branches to the same column?  How can I achieve it with
>  pretty-formats?  Something like %*d?  But * is already taken to mean
>  deref in for-each-ref's --format.
>
>  By the way, the main motivation for all this comes from the fact that
>  git for-each-ref is very nicely written :) Look at how it breaks
>  everything up into atoms and lazily gets the information it needs to
>  display.

If you can put energy into this, I suggest you improve pretty.c a bit,
adding new format_ref_message(), similar to format_commit_message(),
except that it takes a ref. You can extend "struct
format_commit_context" to contain what "struct refinfo" does. I think
pretty.c only lacks a few specifiers that for-each-ref has. I think I
mentioned it in my for-each-ref series already, but we need to think
how to specify "align to the left with the best width" and how
format_ref_message() can figure the width out. A callback function
might do.
--
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]