# [PATCH 1/4] grep docs: pluralize "Example" section

7 messages from 2010-02-26 to 2010-02-26. Participants: Mark Lodato, Junio C Hamano.
Thread: https://gitlist.dev/t/22830

## Mark Lodato, 2010-02-26 03:40

Subject: [PATCH 0/4] git-grep documentation updates
Message-ID: <1267155613-22134-1-git-send-email-lodatom@gmail.com>
URL: https://gitlist.dev/e/1267155613-22134-1-git-send-email-lodatom%40gmail.com

```
This patch series contains some small changes to git-grep.txt.  It is
based on my previous "grep documentation: clarify what files match",
committed to master as 3ac44408.  I posted these as four separate
patches to document each change individually, but they could be squashed
into one if that is preferable.

Mark Lodato (4):
  grep docs: pluralize "Example" section
  grep docs: use AsciiDoc literals consistently
  grep docs: --cached and <tree>... are incompatible
  grep docs: document --no-index option

 Documentation/git-grep.txt |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

```

## Mark Lodato, 2010-02-26 03:40

Subject: [PATCH 1/4] grep docs: pluralize "Example" section
Message-ID: <1267155613-22134-2-git-send-email-lodatom@gmail.com>
URL: https://gitlist.dev/e/1267155613-22134-2-git-send-email-lodatom%40gmail.com
In-Reply-To: <1267155613-22134-1-git-send-email-lodatom@gmail.com>

```
Signed-off-by: Mark Lodato <lodatom@gmail.com>
---
 Documentation/git-grep.txt |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index c44724d..ae663b0 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -174,8 +174,8 @@ OPTIONS
 	If given, limit the search to paths matching at least one pattern.
 	Both leading paths match and glob(7) patterns are supported.
 
-Example
--------
+Examples
+--------
 
 git grep 'time_t' -- '*.[ch]'::
 	Looks for `time_t` in all tracked .c and .h files in the working
-- 
1.7.0

```

## Mark Lodato, 2010-02-26 03:40

Subject: [PATCH 2/4] grep docs: use AsciiDoc literals consistently
Message-ID: <1267155613-22134-3-git-send-email-lodatom@gmail.com>
URL: https://gitlist.dev/e/1267155613-22134-3-git-send-email-lodatom%40gmail.com
In-Reply-To: <1267155613-22134-1-git-send-email-lodatom@gmail.com>

```
The convention for this particular page is to use AsciiDoc literal
strings only for options (`-x` or `--long`), but not for definition list
terms and not for <meta-vars>.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
---
 Documentation/git-grep.txt |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index ae663b0..2e16130 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -98,8 +98,8 @@ OPTIONS
 --files-without-match::
 	Instead of showing every matched line, show only the
 	names of files that contain (or do not contain) matches.
-	For better compatibility with 'git diff', --name-only is a
-	synonym for --files-with-matches.
+	For better compatibility with 'git diff', `--name-only` is a
+	synonym for `--files-with-matches`.
 
 -z::
 --null::
@@ -125,7 +125,7 @@ OPTIONS
 	matches.
 
 -<num>::
-	A shortcut for specifying -C<num>.
+	A shortcut for specifying `-C<num>`.
 
 -p::
 --show-function::
@@ -140,7 +140,7 @@ OPTIONS
 
 -e::
 	The next parameter is the pattern. This option has to be
-	used for patterns starting with - and should be used in
+	used for patterns starting with `-` and should be used in
 	scripts passing user input to grep.  Multiple patterns are
 	combined by 'or'.
 
@@ -163,7 +163,7 @@ OPTIONS
 	Do not output matched lines; instead, exit with status 0 when
 	there is a match and with non-zero status when there isn't.
 
-`<tree>...`::
+<tree>...::
 	Search blobs in the trees for specified patterns.
 
 \--::
-- 
1.7.0

```

## Mark Lodato, 2010-02-26 03:40

Subject: [PATCH 3/4] grep docs: --cached and <tree>... are incompatible
Message-ID: <1267155613-22134-4-git-send-email-lodatom@gmail.com>
URL: https://gitlist.dev/e/1267155613-22134-4-git-send-email-lodatom%40gmail.com
In-Reply-To: <1267155613-22134-1-git-send-email-lodatom@gmail.com>

```
In the synopsis for git-grep(1), show that --cached and <tree>... cannot
be used together.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
---
One downside to this change is that having --cached makes it prominent, which
is good since it's a very common option.  However, I think accuracy is more
important here.

 Documentation/git-grep.txt |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 2e16130..37ce943 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -9,8 +9,7 @@ git-grep - Print lines matching a pattern
 SYNOPSIS
 --------
 [verse]
-'git grep' [--cached]
-	   [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
+'git grep' [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
 	   [-v | --invert-match] [-h|-H] [--full-name]
 	   [-E | --extended-regexp] [-G | --basic-regexp]
 	   [-F | --fixed-strings] [-n]
@@ -21,7 +20,8 @@ SYNOPSIS
 	   [--color | --no-color]
 	   [-A <post-context>] [-B <pre-context>] [-C <context>]
 	   [-f <file>] [-e] <pattern>
-	   [--and|--or|--not|(|)|-e <pattern>...] [<tree>...]
+	   [--and|--or|--not|(|)|-e <pattern>...]
+	   [--cached | <tree>...]
 	   [--] [<pathspec>...]
 
 DESCRIPTION
-- 
1.7.0

```

## Mark Lodato, 2010-02-26 03:40

Subject: [PATCH 4/4] grep docs: document --no-index option
Message-ID: <1267155613-22134-5-git-send-email-lodatom@gmail.com>
URL: https://gitlist.dev/e/1267155613-22134-5-git-send-email-lodatom%40gmail.com
In-Reply-To: <1267155613-22134-1-git-send-email-lodatom@gmail.com>

```
Also clarify --cached and <tree>.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
---
 Documentation/git-grep.txt |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 37ce943..86d7401 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -21,7 +21,7 @@ SYNOPSIS
 	   [-A <post-context>] [-B <pre-context>] [-C <context>]
 	   [-f <file>] [-e] <pattern>
 	   [--and|--or|--not|(|)|-e <pattern>...]
-	   [--cached | <tree>...]
+	   [--cached | --no-index | <tree>...]
 	   [--] [<pathspec>...]
 
 DESCRIPTION
@@ -33,8 +33,11 @@ registered in the index file, or blobs in given tree objects.
 OPTIONS
 -------
 --cached::
-	Instead of searching in the working tree files, check
-	the blobs registered in the index file.
+	Instead of searching tracked files in the working tree, search
+	blobs registered in the index file.
+
+--no-index::
+	Search all files in the working tree, not just those tracked by git.
 
 -a::
 --text::
@@ -164,7 +167,8 @@ OPTIONS
 	there is a match and with non-zero status when there isn't.
 
 <tree>...::
-	Search blobs in the trees for specified patterns.
+	Instead of searching tracked files in the working tree, search
+	blobs in the given trees.
 
 \--::
 	Signals the end of options; the rest of the parameters
-- 
1.7.0

```

## Junio C Hamano, 2010-02-26 05:13

Subject: Re: [PATCH 4/4] grep docs: document --no-index option
Message-ID: <7vocjceg0y.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vocjceg0y.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1267155613-22134-5-git-send-email-lodatom@gmail.com>

```
Mark Lodato <lodatom@gmail.com> writes:

> +--no-index::
> +	Search all files in the working tree, not just those tracked by git.

I gave a quick glance to all four patches.  Everything other than this
looked fine.

This one is meant to be usable outside git directory, and saying "the
working tree" is misleading.  The "work tree" is a technical term that
specifically means the files in the directory hierarchy on the filesystem
that correspond to the index entries that represent them.

It probably should say "the current directory" or something here.

```

## Mark Lodato, 2010-02-26 22:07

Subject: Re: [PATCH 4/4] grep docs: document --no-index option
Message-ID: <ca433831002261407l4d708283m5129c582a55fb1b6@mail.gmail.com>
URL: https://gitlist.dev/e/ca433831002261407l4d708283m5129c582a55fb1b6%40mail.gmail.com
In-Reply-To: <7vocjceg0y.fsf@alter.siamese.dyndns.org>

```
On Fri, Feb 26, 2010 at 12:13 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Mark Lodato <lodatom@gmail.com> writes:
>
>> +--no-index::
>> +     Search all files in the working tree, not just those tracked by git.
>
> This one is meant to be usable outside git directory, and saying "the
> working tree" is misleading.  The "work tree" is a technical term that
> specifically means the files in the directory hierarchy on the filesystem
> that correspond to the index entries that represent them.
>
> It probably should say "the current directory" or something here.

Here's a squashable commit to do just that.

---
 Documentation/git-grep.txt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 86d7401..3e6eaf7 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -37,7 +37,8 @@ OPTIONS
        blobs registered in the index file.

 --no-index::
-       Search all files in the working tree, not just those tracked by git.
+       Search all files in the current directory, not just those tracked
+       by git.

 -a::
 --text::
-- 
1.7.0

```
