Re: [RFC/PATCH 1/9] ref-filter: add %(refname:lalignX) option

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [RFC/PATCH 1/9] ref-filter: add %(refname:lalignX) option

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:05:33

Karthik Nayak [off-list ref] writes:
Add support for %(refname:lalignX) where X is a number.
This will print a shortened refname aligned to the left
followed by spaces for a total length of X characters.
If X is less than the shortened refname size, the entire
shortened refname is printed.
Why would we even want this kind of thing in the first place?  Is
this to make it possible to re-implement some option that exists
already in 'git branch' or 'git tag' as a thin wrapper on top of
this underlying feature?

As a low-level plumbing, I'd rather not to see such an elaborate
formatting option added to for-each-ref; after all, the design of
the command to allow its output properly script-quoted is so that we
can offload such non-essential (meaning: does not need anything only
Git knows; computing the display width of a string and filling the
output space is an example.  As opposed to something like --merged
that needs help from Git, which has the ultimate knowledge on the
topology) processing to Porcelain that uses the command as plumbing.

Re: [RFC/PATCH 1/9] ref-filter: add %(refname:lalignX) option

From: Karthik Nayak <hidden>
Date: 2016-06-15 23:05:33

On Sun, Jun 28, 2015 at 1:09 PM, Junio C Hamano [off-list ref] wrote:
Karthik Nayak [off-list ref] writes:
quoted
Add support for %(refname:lalignX) where X is a number.
This will print a shortened refname aligned to the left
followed by spaces for a total length of X characters.
If X is less than the shortened refname size, the entire
shortened refname is printed.
Why would we even want this kind of thing in the first place?  Is
this to make it possible to re-implement some option that exists
already in 'git branch' or 'git tag' as a thin wrapper on top of
this underlying feature?
As a low-level plumbing, I'd rather not to see such an elaborate
formatting option added to for-each-ref; after all, the design of
the command to allow its output properly script-quoted is so that we
can offload such non-essential (meaning: does not need anything only
Git knows; computing the display width of a string and filling the
output space is an example.  As opposed to something like --merged
that needs help from Git, which has the ultimate knowledge on the
topology) processing to Porcelain that uses the command as plumbing.
Well this is to support the printing of tag in `git tag -l`, if you
see the current
implementation we print refs using "printf("%-15s ", refname);" whenever the
"-n[<n>]" option is given, hence this patch to support printing of refs using a
required spacing.

I couldn't find a way to do with the current options available in
for-each-ref/ref-filter.
Is there a better way to go about this?

-- 
Regards,
Karthik Nayak
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help