Re: [RFC/PATCH] worktree: replace "checkout --to" with "worktree new"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 2, 2015 at 8:41 AM, Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> On Thu, Jul 2, 2015 at 9:52 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>> The recursion protection is indeed no longer needed and gets removed
>> by the "worktree add" patch. However, there are still a few bits of
>> code which want to know that the checkout is happening in a new
>> worktree. I haven't examined them closely yet to diagnose if this
>> specialized knowledge can be eliminated. Perhaps you can weight in. In
>> particular:
>>
>> checkout_paths:
>>     if (opts->new_worktree)
>>         die(_("'%s' cannot be used with updating paths"), "--to");
>
> This one is easy, as "--to" is gone, no reason to report anything about "--to"

In the "worktree add" patch, I kept this one (with s/--to/worktree
add/) assuming that your intention was that a new worktree should
never start with a partial checkout due to specifying paths. Looking
at it more closely, I'm still not convinced that it can be removed.
Given:

    git worktree new <path> <branch> -- <file>

it creates <path> and checks out <file> (and only <file>) into <path>,
however, the resulting worktree is "not on any branch". The latter, I
think is because switch_branches() doesn't get called in this case;
instead, it's just at whatever HEAD was faked up to appease
is_git_directory().
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]