git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Angelo Borsotti <angelo.borsotti@gmail.com>,
	Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	git@vger.kernel.org
Subject: Re: checkout extra files
Date: Mon, 10 Sep 2012 12:19:04 -0400	[thread overview]
Message-ID: <20120910161904.GC9435@sigill.intra.peff.net> (raw)
In-Reply-To: <7vk3w5woc4.fsf@alter.siamese.dyndns.org>

On Fri, Sep 07, 2012 at 01:49:15PM -0700, Junio C Hamano wrote:

> -- >8 --
> gitcli: contrast wildcard given to shell and to git
> 
> People who are not used to working with shell may intellectually
> understand how the command line argument is massaged by the shell
> but still have a hard time visualizing the difference between
> letting the shell expand fileglobs and having Git see the fileglob
> to use as a pathspec.

I think this is an improvement, but...

> diff --git c/Documentation/gitcli.txt w/Documentation/gitcli.txt
> index ea17f7a..220621b 100644
> --- c/Documentation/gitcli.txt
> +++ w/Documentation/gitcli.txt
> @@ -38,6 +38,22 @@ arguments.  Here are the rules:
>     you have to say either `git diff HEAD --` or `git diff -- HEAD` to
>     disambiguate.
>  
> + * Many commands allow wildcards in paths, but you need to protect
> +them from getting globbed by the shell.  These two mean different things:
> ++
> +--------------------------------
> +$ git checkout -- *.c
> +$ git checkout -- \*.c
> +--------------------------------
> ++
> +The former lets your shell expand the fileglob, and you are asking
> +the dot-C files in your working tree to be overwritten with the version
> +in the index.  The latter passes the `*.c` to Git, and you are asking
> +the paths in the index that match the pattern to be checked out to your
> +working tree.  After running `git add hello.c; rm hello.c`, you will _not_
> +see `hello.c` in your working tree with the former, but with the latter
> +you will.
> +
>  When writing a script that is expected to handle random user-input, it is
>  a good practice to make it explicit which arguments are which by placing
>  disambiguating `--` at appropriate places.

Look at the paragraph below your addition. It is typographically outside
of the bulleted list you are adding to, but it really makes sense
directly after the prior two bullet points, which are explicitly about
disambiguation between revisions and paths. Your addition splits them
apart.

Does it make sense to join that final paragraph into what is now the
third bullet, and then add your new text (the fourth bullet) after?

-Peff

  parent reply	other threads:[~2012-09-10 16:19 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
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 [this message]
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=20120910161904.GC9435@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=angelo.borsotti@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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).