git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Angelo Borsotti <angelo.borsotti@gmail.com>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: checkout extra files
Date: Tue, 04 Sep 2012 09:15:05 -0700	[thread overview]
Message-ID: <7v8vcpdat2.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vpq61dfn9.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Tue, 04 Sep 2012 07:30:34 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Now we have f1 and f2 in the working tree.
>
>> $ git checkout e6f9 -- *
>
> That is the same as "git checkout e6f935e -- f1 f2", as the shell
> expanded "*" into "f1" and "f2".
>
>> error: pathspec 'f2' did not match any file(s) known to git.
>>
>> Note the error.
>
> Yes?
>
>> It is clear that the set of file names that git checkout is taking is
>> the union of the ones that
>> match the specified path ('*') in the work directory (gittest) with
>> the ones that match the
>> path in the specified commit (e6f9).
>
> The command tells git to check out "f1" and "f2" out of the tree of
> e6f935e, and git found "f1" but did not find "f2" and reported an
> error.  I do not see a room or need for "union" to come into the
> picture to explain what we see in the above transcript.

Actually, I "kind of sort of" can see where that "union" is coming
from, if I squint my eyes hard enough.

Yes, it makes it look like the path affected has some relationship
between two sets of paths:

 - set W, which consists of f1 and f2, that is the result of
   matching '*' against working tree files; and

 - set T, which consists of f1 (but not f2), that is the result of
   matching '*' against the tree contained in e6f935e

and the intersection of W and T (i.e. f1) is what is checked out.

But that is not what is happening at all.  What goes on is far
simpler than that.

 - the shell sees '*', matches it against working tree files, to
   obtain "f1" and "f2";

 - the shell tells "git" to "checkout e6f935e -- f1 f2";

 - "git" looks into the tree of e6f935e to find paths that match
   "f1" and "f2".

When "git" is run by the shell in the last step, it has _no_ clue
that the end user typed "*" from the shell.  It only sees "f1" and
"f2" on the command line.  There is no "set T" to be intersected
with "set W", so stop thinking in those terms, and you will be fine.

Now the question is, _you_ will be fine, but can the documentation 
be updated in such a way so that it will help _others_ to also stop
thinking about "intersection between set W and set T"?  I do not
have a good answer to that.

  reply	other threads:[~2012-09-04 16:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 13:42 checkout extra files Angelo Borsotti
2012-09-03 13:55 ` Carlos Martín Nieto
     [not found]   ` <CAB9Jk9AkFW-fAqOZuhCMgMBdEZwDpe5ZG9Dkse=Wz_x9LvJEPw@mail.gmail.com>
2012-09-03 14:47     ` Carlos Martín Nieto
     [not found]       ` <CAB9Jk9BjO+HdxhaGxEyaDoXgGisi0QpuVvsx3dZUnJV1VoKN1g@mail.gmail.com>
2012-09-04  1:57         ` Carlos Martín Nieto
2012-09-03 13:59 ` Nguyen Thai Ngoc Duy
2012-09-03 19:36   ` Junio C Hamano
2012-09-04  1:49     ` Nguyen Thai Ngoc Duy
2012-09-04  2:55       ` Junio C Hamano
2012-09-04  7:15         ` Angelo Borsotti
2012-09-04  8:53           ` Junio C Hamano
2012-09-04 14:30           ` Junio C Hamano
2012-09-04 16:15             ` Junio C Hamano [this message]
2012-09-07 20:49               ` Junio C Hamano
     [not found]                 ` <CAB9Jk9BtZzgi32kxVTbGC7eAjFG41bdae=MaK==sKq=9ohf8_w@mail.gmail.com>
2012-09-08 18:54                   ` Junio C Hamano
2012-09-10  0:24                     ` Junio C Hamano
2012-09-08 20:40                 ` Philip Oakley
2012-09-09  3:31                   ` Junio C Hamano
2012-09-09 13:48                     ` Matthieu Moy
2012-09-09 18:23                       ` Junio C Hamano
2012-09-09 23:25                         ` Philip Oakley
2012-09-10 16:19                 ` Jeff King
2012-09-10 17:09                   ` Junio C Hamano
2012-09-10 17:19                     ` Jeff King
2012-09-10 19:35                       ` Junio C Hamano
2012-09-10 19:53                         ` [PATCH 1/2] gitcli: formatting fix Junio C Hamano
2012-09-10 19:54                           ` [PATCH 2/2] gitcli: contrast wildcard given to shell and to git Junio C Hamano
2012-09-10 20:11                         ` checkout extra files Jeff King
2012-09-10 20:34                           ` Junio C Hamano
2012-09-04 10:14         ` Nguyen Thai Ngoc Duy
     [not found]           ` <CAB9Jk9CNYr6LfWvyVqXvHjh7dzhUAuzkufqO9YMeOXg08D2cJw@mail.gmail.com>
     [not found]             ` <CACsJy8AUYigHVKjzE-0NT0hnOrQWdufN+COmkk=2Q8L1Rimytw@mail.gmail.com>
2012-09-04 13:24               ` Angelo Borsotti
2012-09-04 16:49                 ` Junio C Hamano
2012-09-04 19:29                   ` Angelo Borsotti
2012-09-04 20:44                     ` Junio C Hamano
2012-09-04 22:53                       ` Philip Oakley
2012-09-04 23:31                         ` Junio C Hamano
2012-09-04 15:31           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v8vcpdat2.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=angelo.borsotti@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).