From: Eric Sunshine Date: Sun, 13 Sep 2015 04:25:29 GMT Subject: Re: [PATCH v7 3/3] worktree: add 'list' command Message-ID: In-Reply-To: <1441402769-35897-4-git-send-email-rappazzo@gmail.com> On Fri, Sep 4, 2015 at 5:39 PM, Michael Rappazzo wrote: > 'git worktree list' iterates through the worktree list, and outputs > the worktree dir. By default, only the worktree path is output. Comments below in addition to Junio's... > Supported options include: > --skip-bare: do not output bare worktrees > --verbose: include the current head and ref (if applicable), also > decorate bare worktrees I don't care strongly at this point, but an alternate, (possibly) more reviewer-friendly, approach would be to split this into several patches: the first would add a bare-bones "list" command, and each subsequent patch would flesh it out by introducing one option and/or enhancing the output in some way. > Signed-off-by: Michael Rappazzo > --- > diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt > index fb68156..b9339ed 100644 > --- a/Documentation/git-worktree.txt > +++ b/Documentation/git-worktree.txt > @@ -11,6 +11,7 @@ SYNOPSIS > [verse] > 'git worktree add' [-f] [--detach] [-b ] [] > 'git worktree prune' [-n] [-v] [--expire ] > +'git worktree list' [-v] [--skip-bare] I'm somewhat skeptical of the --skip-bare option. Recalling my v2 review[1] skepticism of the --main-only option: The more options we have, the more we have to document, test, and support... Thus, I wonder how much value this option has. Presumably, for scripters, we will want to have a --porcelain option, the output of which will contain useful information about a worktree, including whether it's bare, and a script can, on its own, easily filter out a bare worktree if desired. [1]: http://article.gmane.org/gmane.comp.version-control.git/275528 > DESCRIPTION > ----------- > @@ -59,6 +60,10 @@ prune:: > > Prune working tree information in $GIT_DIR/worktrees. > > +list:: > + > +List the main worktree followed by each of the linked worktrees. > + > OPTIONS > ------- > > @@ -89,10 +94,14 @@ OPTIONS > -v:: > --verbose:: > With `prune`, report all removals. > + With `list`, show more information about each worktree. This includes > + if the worktree is bare, the revision currently checked out, and the > + branch currently checked out (or 'detached HEAD' if none). Hmm, this prints both the SHA1 and the branch name (or literal string "detached HEAD")? Is that a good use of screen real-estate? In particular, I'm wondering how useful the SHA1 is to the user when not detached. I would expect (perhaps wrongly) that it would be sufficient to output either the branch name *or* the SHA1 (which implies "detached" without having to say so literally). > --expire