git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Mikael Magnusson
Message 5 of 6 in “Worktree: for-each function and list command”
  1. 0/2 Worktree: for-each function and list commandMichael Rappazzo, Aug 22, 2015
  2. 1/2 worktree: add 'for_each_worktree' functionMichael Rappazzo, Aug 22, 2015
  3. 2/2 worktree: add 'list' commandMichael Rappazzo, Aug 22, 2015
  4. Junio C HamanoAug 24, 2015
  5. Eric SunshineAug 25, 2015
  6. Mikael MagnussonAug 25, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.