git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH/WIP 0/9] for-each-ref format improvements
Date: Sun, 19 May 2013 18:54:05 +0700	[thread overview]
Message-ID: <CACsJy8DMF3NzvMRUO56H+EwpXSjmY9qzdNdv9cGJ9XxUO=ekJA@mail.gmail.com> (raw)
In-Reply-To: <CALkWK0=7z91A54jSzc2yZU3g50u8H_f8su1Y+i=D+KxYtqor5g@mail.gmail.com>

On Sun, May 19, 2013 at 6:11 PM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
> Nguyễn Thái Ngọc Duy wrote:
>> The purpose of this series is to make "for-each-ref --format" powerful
>> enough to display what "branch -v" and "branch -vv" do so that we
>> could get rid of those display code and use for-each-ref code instead.
>
> Damn, you beat me to it.  I just introduced color, and was working on
> alignment.  See $gmane/224692.

Hmm.. I missed that mail (or I wouldn't have worked on this already).
Do you want to take over?

>>  - %(tracking[:upstream]) gives us the exact output that branch -v[v]
>>    does. %(upstream) does not include []. We can't change its
>>    semantics.
>
> There's already an atom called "upstream", and "upstream:short" works.
>  Why not introduce "upstream:diff" for "[ahead x, behind y]" and
> "upstream:shortdiff" for "<>" (like in the prompt)?

"branch -vv" shows [upstream: ahead x, behind y]. We need a syntax to
cover that too.

>>  - %(color:...) is pretty much the same as %C family in pretty code.
>>    I haven't added code for %(color:foo) == %C(foo) yet. There's a
>>    potential ambiguity here: %C(red) == %Cred or %C(red)??
>
> I'd vote for dropping %C<name> altogether and just go with %C(<name>).
>  Why do we need %(color:<name>) at all?

pretty and for-each-ref format seem to be on the opposite: one is
terse, one verbose. Unless you are going to introduce a lot of new
specifiers (and in the worst case, bring all pretty specifiers over,
unify underlying code), I think we should stick with %(xx) convention.

>>  - %(...:aligned) to do left aligning. I'm not entirely sure about
>>    this. We might be able to share code with %>, %< and %>< from
>>    pretty.c. But we need improvements there too because in
>>    for-each-ref case, we could calculate column width but %< would
>>    require the user to specify the width.
>
> Yeah, I think we should go with the %> and %< you introduced in
> pretty.c.  Yes, I want to be able to specify width.

I still think we should follow %(...), e.g. %(left:N), %(right:N) as
equivalent of %< and %>...

>>    Do people expect fancy layout with for-each-ref (and branch)? If so
>>    we might need to have %(align) or something instead of the simple
>>    left alignment case in %(...:aligned)
>
> Why should we deviate from the pretty case?  What is different here?

Laziness plays a big factor :) So again, you want to take over? ;)

>>  - We may need an equivalent of the space following % in pretty
>>    format. If the specifier produces something, then prepend a space,
>>    otherwise produce nothing. Do it like %C( tracking) vs
>>    %C(tracking)??
>
> Yeah, sounds good.
>
>> You can try this after applying the series, which should give you the
>> about close to 'branch -v'. %(tracking) coloring does not work though.
>
> Why doesn't %(tracking) coloring work?

it uses builtin/branch.c:branch_use_color. Eventually
fill_tracking_info() should be moved to for-each-ref.c and pass
branch_use_color in as an argument. But for now, I just leave it
broken.
--
Duy

  parent reply	other threads:[~2013-05-19 11:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19 10:27 [PATCH/WIP 0/9] for-each-ref format improvements Nguyễn Thái Ngọc Duy
2013-05-19 10:27 ` [PATCH 1/9] quote.c: make sq_quote_print a slight wrapper of sq_quote_buf Nguyễn Thái Ngọc Duy
2013-05-19 11:39   ` Felipe Contreras
2013-05-19 10:27 ` [PATCH 2/9] for-each-ref: convert to use *_quote_buf instead of _quote_print Nguyễn Thái Ngọc Duy
2013-05-19 11:39   ` Felipe Contreras
2013-05-19 10:27 ` [PATCH 3/9] for-each-ref: avoid printing each element directly to stdout Nguyễn Thái Ngọc Duy
2013-05-19 11:17   ` Ramkumar Ramachandra
2013-05-19 11:58     ` Duy Nguyen
2013-05-19 10:27 ` [PATCH 4/9] for-each-ref: add %(current) for current branch marker Nguyễn Thái Ngọc Duy
2013-05-19 11:14   ` Ramkumar Ramachandra
2013-05-19 10:27 ` [PATCH 5/9] for-each-ref: add %(tracking[:upstream]) for tracking info Nguyễn Thái Ngọc Duy
2013-05-19 11:18   ` Ramkumar Ramachandra
2013-05-19 11:38     ` Felipe Contreras
2013-05-19 11:43       ` Duy Nguyen
2013-05-19 11:48         ` Ramkumar Ramachandra
2013-05-19 12:03           ` Felipe Contreras
2013-05-19 10:27 ` [PATCH 6/9] for-each-ref: add %(color:...) Nguyễn Thái Ngọc Duy
2013-05-19 11:25   ` Ramkumar Ramachandra
2013-05-19 10:27 ` [PATCH 7/9] for-each-ref: prepoplulate all atoms before show_ref() Nguyễn Thái Ngọc Duy
2013-05-19 10:27 ` [PATCH 8/9] for-each-ref: merge show_ref into show_refs Nguyễn Thái Ngọc Duy
2013-05-19 10:27 ` [PATCH 9/9] for-each-ref: support %(...:aligned) for left alignment Nguyễn Thái Ngọc Duy
2013-05-19 11:32   ` Ramkumar Ramachandra
2013-05-19 11:41     ` Duy Nguyen
2013-05-19 11:11 ` [PATCH/WIP 0/9] for-each-ref format improvements Ramkumar Ramachandra
2013-05-19 11:36   ` Felipe Contreras
2013-05-19 11:54   ` Duy Nguyen [this message]
2013-05-19 12:08     ` Ramkumar Ramachandra
2013-05-19 12:28       ` Duy Nguyen
2013-05-19 13:07         ` Ramkumar Ramachandra
2013-05-20  4:29 ` Junio C Hamano
2013-05-21 17:21 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACsJy8DMF3NzvMRUO56H+EwpXSjmY9qzdNdv9cGJ9XxUO=ekJA@mail.gmail.com' \
    --to=pclouds@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).