Re: [PATCH v5 2/2] worktree: add 'list' command
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 25, 2015, 01:07 UTC
- Message-ID
- <CAPig+cRQ0bwhx9dB=j6VWY4EieJ6Emzqru9Wmwy=4tAFRt6Otg@mail.gmail.com>
- In-Reply-To
- <xmqqpp2c4l5u.fsf@gitster.dls.corp.google.com>
On Mon, Aug 24, 2015 at 2:05 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> Michael Rappazzo <rappazzo@gmail.com> writes:
>> + strbuf_strip_suffix(&head_ref, "\n");
>> +
>> + if (starts_with(head_ref.buf, ref_prefix)) {
>> + /* branch checked out */
>> + strbuf_remove(&head_ref, 0, strlen(ref_prefix));
>> + /* } else {
>> + * headless -- no-op
>> + */
>> + }
>> + printf("%s (%s)\n", path, head_ref.buf);
>
> Is this new command meant to be a Porcelain? This would not work as
> a plumbing that produces a machine-parseable stable output.
>
> I am not saying that it _should_; I do not know if we even need a
> 'list' command that is driven from an end-user script that gives
> anything more than "where the work trees are".
>
> My inclination is to suggest dropping the "which branch" code
> altogether and only give "path_only" behaviour.The "which branch" was probably added in response to this [1] review, which suggested that at some point, we might want to provide the user with interesting information about each worktree, such as branch/detached head, tag, locked status (plus lock reason and whether currently accessible), prune-able status (plus reason). This could optionally be controlled by --verbose or some other extended formatting option.
The same review also suggested a --porcelain option for script writers.
[1]: http://article.gmane.org/gmane.comp.version-control.git/275528