From: sean <seanlkml@sympatico.ca>
To: git@vger.kernel.org
Subject: git-grep documentation
Date: Fri, 20 Jan 2006 08:47:23 -0500 [thread overview]
Message-ID: <BAYC1-PASMTP07F7EA1F3B544C07AA01F8AE1F0@CEZ.ICE> (raw)
Message-ID: <20060120084723.5ba3170d.seanlkml@sympatico.ca> (raw)
It looks as though git-grep.sh was coded to allow git-ls-files
options to be passed after a '--' marker. However, this marker will
never be seen by the script unless the user identifies the <pattern>
by preceding it with an '-e'.
If it's not seen the '--' ends up getting passed to git-ls-files and any
options are mistakenly interpreted as paths. For instance, the following
two commands will do different things:
$ git-grep -e NAME -- --others Documentation/git-grep.txt
$ git-grep NAME -- --others Documentation/git-grep.txt
Either the comment in the git-grep.sh script should be changed to
say that only paths are acceptable after the '--' or fixed up to
handle this case a bit better. The documentation patch below is
only applicable if the script is fixed first.
Sean
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 2bfd8ed..c2c6ff3 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -8,7 +8,7 @@ git-grep - print lines matching a patter
SYNOPSIS
--------
-'git-grep' [<option>...] <pattern> [<path>...]
+'git-grep' [<option>...] [-e] <pattern> [-- [<ls option>...]] [<path>...]
DESCRIPTION
-----------
@@ -20,12 +20,21 @@ OPTIONS
-------
<option>...::
Either an option to pass to `grep` or `git-ls-files`.
- Some `grep` options, such as `-C` and `-m`, that take
- parameters are known to `git-grep`.
+
+ The specific `git-ls-files` options that may be supplied are:
+ `--cached`, `--deleted`, `--others`, `--killed`, `--ignored`,
+ `--exclude=*`, `--exclude-from=*`, or `--exclude-per-directory=*`.
+
+ All other options will be passed to `grep`.
<pattern>::
The pattern to look for.
+<ls option>...::
+ Additional options for `git-ls-files` which must be preceded
+ by the '--' marker. See `git-ls-files` for a list of
+ available options.
+
<path>...::
Optional paths to limit the set of files to be searched;
passed to `git-ls-files`.
next reply other threads:[~2006-01-20 13:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060120084723.5ba3170d.seanlkml@sympatico.ca>
2006-01-20 13:47 ` sean [this message]
2006-01-21 8:09 ` git-grep documentation Junio C Hamano
[not found] ` <20060121091318.4508466b.seanlkml@sympatico.ca>
2006-01-21 14:13 ` sean
2006-01-21 19:06 ` Junio C Hamano
[not found] ` <20060121141953.2a1a4624.seanlkml@sympatico.ca>
2006-01-21 19:19 ` sean
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=BAYC1-PASMTP07F7EA1F3B544C07AA01F8AE1F0@CEZ.ICE \
--to=seanlkml@sympatico.ca \
--cc=git@vger.kernel.org \
/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