# [PATCH] Documentation: git-add: correct first example

3 messages from 2010-02-08 to 2010-02-08. Participants: Greg Bacon, Junio C Hamano.
Thread: https://gitlist.dev/t/22571

## Greg Bacon, 2010-02-08 17:35

Subject: [PATCH] Documentation: git-add: correct first example
Message-ID: <1265650551-32664-1-git-send-email-gbacon@dbresearch.net>
URL: https://gitlist.dev/e/1265650551-32664-1-git-send-email-gbacon%40dbresearch.net

```
The first example for git-add covers recursive adding of patterns but
contains an extra backslash. If copied verbatim, the command fails
with

fatal: pathspec 'Documentation/\*.txt' did not match any files

This patch corrects the problem and adds an equivalent invocation.

Signed-off-by: Greg Bacon <gbacon@dbresearch.net>
---
 Documentation/git-add.txt |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index f74fcf3..93e8f57 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -149,11 +149,12 @@ those in info/exclude.  See linkgit:gitrepository-layout[5].
 EXAMPLES
 --------
 
-* Adds content from all `\*.txt` files under `Documentation` directory
+* Adds content from all `*.txt` files under `Documentation` directory
 and its subdirectories:
 +
 ------------
-$ git add Documentation/\\*.txt
+$ git add Documentation/\*.txt
+$ git add 'Documentation/*.txt'  # same thing
 ------------
 +
 Note that the asterisk `\*` is quoted from the shell in this
-- 
1.6.5.5

```

## Junio C Hamano, 2010-02-08 19:22

Subject: Re: [PATCH] Documentation: git-add: correct first example
Message-ID: <7vsk9bmt1h.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vsk9bmt1h.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1265650551-32664-1-git-send-email-gbacon@dbresearch.net>

```
Greg Bacon <gbacon@dbresearch.net> writes:

> The first example for git-add covers recursive adding of patterns but
> contains an extra backslash.

Correct.  

> Signed-off-by: Greg Bacon <gbacon@dbresearch.net>
> ---
>  Documentation/git-add.txt |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
> index f74fcf3..93e8f57 100644
> --- a/Documentation/git-add.txt
> +++ b/Documentation/git-add.txt
> @@ -149,11 +149,12 @@ those in info/exclude.  See linkgit:gitrepository-layout[5].
>  EXAMPLES
>  --------
>  
> -* Adds content from all `\*.txt` files under `Documentation` directory
> +* Adds content from all `*.txt` files under `Documentation` directory

For this, both

    http://www.kernel.org/pub/software/scm/git/docs/git-add.html

and output from

    git help add

in my local build seem to be rendered correctly by AsciiDoc.

>  and its subdirectories:
>  +
>  ------------
> -$ git add Documentation/\\*.txt

This indeed results in double-backslash in the output.

> +$ git add Documentation/\*.txt

and this seems to fix it.

Thanks.

```

## Junio C Hamano, 2010-02-08 20:08

Subject: Re: [PATCH] Documentation: git-add: correct first example
Message-ID: <7v6367lccu.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v6367lccu.fsf%40alter.siamese.dyndns.org
In-Reply-To: <7vsk9bmt1h.fsf@alter.siamese.dyndns.org>

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

>>  and its subdirectories:
>>  +
>>  ------------
>> -$ git add Documentation/\\*.txt
>
> This indeed results in double-backslash in the output.
>
>> +$ git add Documentation/\*.txt
>
> and this seems to fix it.
>
> Thanks.

To look for similar breakages, I ran

    git grep -n -e '\\\\' -- 'Documentation/*.txt'

and found this in git-rm.txt:

    EXAMPLES
    --------
    git rm Documentation/\\*.txt::
            Removes all `\*.txt` files from the index that are under the
            `Documentation` directory and any of its subdirectories.

What is intereseting is that this is rendered correctly.  Quoting rule in
AsciiDoc is mysterious...

It turns out that the breakage in "git add" documentation was a
regression; the examples were written in a similar way to the one in "git
rm" documentation.  When 921177f (Documentation: improve "add", "pull" and
"format-patch" examples, 2008-05-07) converted it to displayed text,
nobody noticed that the difference in the backslash quoting rule between
the enumeration header and displayed text.

```
