Re: [PATCH 22/32] checkout: support checking out into a new working directory

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

 



On Sun, Aug 31, 2014 at 3:50 AM, Philip Oakley <philipoakley@xxxxxxx> wrote:
>> @@ -225,6 +225,13 @@ This means that you can use `git checkout -p` to
>> selectively discard
>> edits from your current working tree. See the ``Interactive Mode''
>> section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
>>
>> +--to=<path>::
>> + Check out a new branch in a separate working directory at
>
>
> Is this actually a 'new' branch? Perhaps s/new //. More below.

Only when -b is also used. Will fix.

>> +All checkouts share the same repository. Linked checkouts see the
>> +repository a bit different from the main checkout. When the checkout
>> +"new" reads the path $GIT_DIR/HEAD for example, the actual path
>
>
> I was caught out by "new" (in quotes) here. I see that the commit msg in
> patch 24 uses 'new-branch', while in patch 30 <new> is used. Is this "new"
> (above) refering to the branch name (or detatched head), or a nmemonic for
> the path? The use of "new working directory" in the previous paragraph is a
> well qualified use of new, so I'm looking to ensure that it's well qualified
> here.
>
> My immediate reaction was that a consistent use of <new> in the three
> patches may be all that's needed

It's probably clearer if I start that paragraph with "git checkout
--to <somewhere> <branch>" then "new" is replaced with "<branch>". The
thing is, each checkout needs a unique id, and this id is usually the
branch name to be checked out. But after worktree creation, even if
the user switches branch, the id remains the same.

>> +returned could be $GIT_DIR/repos/new/HEAD. This ensures checkouts
>
>
> surely s/could/would/? or have I misunderstood?

It's ../repos/new/...if the directory with the same name does not
exist. If it does, a number will follow after 'new' to make it unique,
e.g. ../repos/new1/... Perhaps this paragraph could be rewritten like
this

All checkouts share the same repository. Linked checkouts see the
repository a bit different from the main checkout. When you perform
the command

------------
git checkout --to <some-location> <some-branch>
------------

The checkout at <some-location> will have a unique id that is also the
branch name (e.g. "<some-branch>"). A number may be appended to the id
to make it unique. All worktree-specific files of this new checkout
are in $GIT_DIR/repos/<unique-id> of the main checkout. So "HEAD"
inside the linked checkout will be resolved to
"$GIT_DIR/repos/<some-branch>/HEAD", while "HEAD" from the main
checkout remains "$GIT_DIR/HEAD".
-- 
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]