Re: [RFC/PATCH] worktree: replace "checkout --to" with "worktree new"
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 2, 2015, 19:00 UTC
- Message-ID
- <CAPig+cTm7Qzxr_E+_p6UYmPrsQzTFCN-Mouu-FigNqRH=gSPKg@mail.gmail.com>
- In-Reply-To
- <CAPig+cR2tn6G0N1sSsrkP_Lo_U_hjLYi08qEsMr+gcsjheaX7A@mail.gmail.com>
On Thu, Jul 2, 2015 at 2:45 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 20 quoted lines
> There's another instance: 3473ad0 (checkout: don't require a work tree
> when checking out into a new one, 2014-11-30) added this:
>
> if (!new_worktree)
> setup_work_tree();
>
> which the "worktree add" patch changed to:
>
> setup_work_tree();
>
> which doesn't hurt (since setup_work_tree() protects itself against
> multiple invocations) but isn't semantically clean. If I understand
> correctly, I think a better approach would be to move the
> setup_work_tree() call to worktree.c just before it invokes
> git-checkout, and revert 3473ad0 entirely (including this bit):
>
> - { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
> +{ "checkout", cmd_checkout, RUN_SETUP },
>
> so that git-checkout once again requires a worktree.I mis-stated that a bit. The bit about "multiple invocations" isn't relevant. The point is that I think that 3473ad0 can simply be reverted as long as worktree.c calls setup_work_tree() before invoking git-checkout.