Re: [PATCH] checkout & worktree: introduce a core.DWIMRemote setting
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 4, 2018, 07:23 UTC
- Message-ID
- <CAPig+cS90ro649V2Oy5kytwpAsmYWdGG3depHhd1AFq3Cxn=7A@mail.gmail.com>
- In-Reply-To
- <CAPig+cSRBBzXDWMJd5k=ZGOt_ayATWB6fZQrcMqJkP8ja4Tq+g@mail.gmail.com>
On Fri, May 4, 2018 at 3:14 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 22 quoted lines
> The setting up of a remote-tracking branch is DWIM'd as of 4e85333197
> ("worktree: make add <path> <branch> dwim", 2017-11-26); it doesn't
> require an explicit option to enable it (though tracking can be
> disabled via --no-track). The "guess-remote" feature does something
> entirely different; it was added to avoid backward compatibility
> problems.
>
> In long-form:
>
> git worktree add <path> <branch>
>
> adds a new worktree at <path> and checks out <branch>. As originally
> implemented, shortened:
>
> git worktree add <path>
>
> does one type of DWIM, as a convenience, and pretends that the user
> actually typed:
>
> branch=$(basename <path>)
> git branch $branch HEAD
> git workree add <path> $branchThis explanation isn't wrong, but it conflates two separate features, thus is confusing. The $(basename <branch>) DWIM'ing from the short form of the command, "git worktree add <path>", doesn't actually have anything to do with the DWIM'ing added by 4e85333197 ("worktree: make add <path> <branch> dwim", 2017-11-26), which merely tries to DWIM a remote-tracking branch of similar name to $branch (whether $branch came from long or short form of the command), so I confused the issue unnecessarily by talking about the short form.