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 12:13 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>>    I noticed GIT_CHECKOUT_NEW_WORKTREE environment variabl that does
>>    not seem to be documented.  Is this something we still need?
>>    The log message of 529fef20 (checkout: support checking out into
>>    a new working directory, 2014-11-30) does not tell us much.
>
> Yes, it's still used for the same purpose as before the conversion: as
> a private signal to the sub git-checkout invocation that it's
> operating on a new worktree. When defined, it sets the
> 'new_worktree_mode' flag in checkout.c, and there are still a few bits
> of code which apparently need to know about it. It would be nice to
> eliminate this special knowledge from checkout.c, however, I'm not yet
> familiar enough with the checkout code to determine if doing so is
> viable.

I think it can go away. When "--to" is used, I have to re-execute "git
checkout" command again after creating the new worktree. I could
process the command line arguments from the first execution, delete
"--to", then use the remaining options to run checkout the second
time. But I chose to pass the entire command line to the second
execution. The env is used to let the second run know it should ignore
"--to" (or we get infinite recursion). With "git worktree add" this
recursion disappears and this env var has no reason to exist.
-- 
Duy
--
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]