Subject: Re: [PATCH v6 0/6] worktree: teach "add" to check out existing branches

From: Thomas Gummerer <[email-masked]>
Date: Mon, 9 Apr 2018 20:47:23 +0100

On 04/08, Eric Sunshine wrote:
> On Sun, Apr 8, 2018 at 10:24 AM, Thomas Gummerer <[email-masked]> wrote:
> > On 04/08, Eric Sunshine wrote:
> >> On Sat, Mar 31, 2018 at 11:17 AM, Thomas Gummerer <[email-masked]> wrote:
> > Let me think through some of the cases here, of 'git worktre add
> > <path> <commit-ish>' with various flags and what the UI would be with
> > that added:
> >
> >   - no flags:
> >
> >     $ git worktree add ../test origin/master
> >     Checking out 'origin/master'
> >     Checking out files: ...%
> >     New worktree HEAD is now at c2a499e6c Merge branch 'jh/partial-clone'
> >
> >   - -b branch:
> >
> >     $ git worktree add -b test ../test origin/master
> >     Creating branch 'test'
> >     Checking out 'origin/master'
> 
> Did you mean "Checking out 'test'"?
> 
> >     Checking out files: ...%
> >     New worktree HEAD is now at c2a499e6c Merge branch 'jh/partial-clone'
> >
> >     Would we want to omit the "Checking out ..." here?  I'm leaning
> >     towards yes, but dunno?
> 
> To which "Checking out" message do you refer, the one showing the
> branch name or the one showing the checkout progress?
> 
> I'd probably agree that showing both "Creating" and "Checkout out" is
> overkill. However, see my response[1] to your "fixup!" patch in which
> I explore the idea that unifying "Checking out 'branch' and "Creating
> branch" messages may be a good idea and get us out of some UI jams
> which seem to be cropping up.
> 
> [1]: https://public-inbox.org/git/[email-masked]/T/#m5d38b0c6427609e8c36aa6af83d518791c1e1581
> 
> >   - Original dwim with --detach flag
> >
> >     $ git worktree add --detach ../test
> >     Checking out 'c2a499e6c'
> >     Checking out files: ...%
> >     New worktree HEAD is now at c2a499e6c Merge branch 'jh/partial-clone'
> >
> > Looking at this, I'm not sure what's best here.  I'm not sure I'm a
> > fan of the duplicate "Checking out " message (I assume that's what you
> > meant above, or did you mean just "Checkout ..."?)
> 
> Taking [1] into account, this might become something like:
> 
>     $ git worktree add --detach ../test
>     Preparing worktree (detached HEAD c2a499e6c)
>     Checking out files: ...%
>     New worktree HEAD is now at c2a499e6c Gobbledygook

The more I look at this solution, the more I like it.  I'll try to
implement this to see if there's anything I'm not thinking of right
now, but I think I'll take the suggestion and send a re-roll with it
implemented. 

> > I als don't think it gives too much context compared to just "Checking
> > out files: ...%".  I think it gives a bit more context when that
> > message is not displayed at all, as it shows whether files are checked
> > out or not, but if we do that, when we create a new branch, the amount
> > of output we'd display is getting a bit long, to the point where I
> > suspect users would just not read it anymore.
> >
> > So I personally don't feel like this is worth it, even though it may
> > give some context in some cases.
> 
> Fair enough observation. The idea suggested in [1] may keep output to
> a reasonable amount.