From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 02/12] git-grep: support --no-external-grep
Date: Wed, 23 Jul 2008 21:55:49 +0700 [thread overview]
Message-ID: <20080723145549.GA29067@laptop> (raw)
this one is mainly for testing builtin grep
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
builtin-grep.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/builtin-grep.c b/builtin-grep.c
index cc9ba6b..ee96d01 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -20,6 +20,8 @@
#endif
#endif
+static int no_external_grep;
+
/*
* git grep pathspecs are somewhat different from diff-tree pathspecs;
* pathname wildcards are allowed.
@@ -386,7 +388,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
* we grep through the checked-out files. It tends to
* be a lot more optimized
*/
- if (!cached) {
+ if (!cached && !no_external_grep) {
hit = external_grep(opt, paths, cached);
if (hit >= 0)
return hit;
@@ -544,6 +546,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
cached = 1;
continue;
}
+ if (!strcmp("--no-external-grep", arg)) {
+ no_external_grep = 1;
+ continue;
+ }
if (!strcmp("-a", arg) ||
!strcmp("--text", arg)) {
opt.binary = GREP_BINARY_TEXT;
--
1.5.5.GIT
next prev reply other threads:[~2008-07-23 14:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 14:57 [PATCH 10/12] git-checkout: support --full and --path to manipulate sparse checkout Nguyễn Thái Ngọc Duy
2008-07-23 14:57 ` [PATCH 08/12] git-clone: support --path to do sparse clone Nguyễn Thái Ngọc Duy
2008-07-23 14:56 ` [PATCH 03/12] Introduce sparse prefix Nguyễn Thái Ngọc Duy
2008-07-23 14:55 ` Nguyễn Thái Ngọc Duy [this message]
2008-07-23 19:01 ` [PATCH 02/12] git-grep: support --no-external-grep Petr Baudis
2008-07-23 19:05 ` Petr Baudis
2008-07-24 20:26 ` Alex Riesen
2008-07-24 23:16 ` Nguyen Thai Ngoc Duy
2008-07-24 17:19 ` [PATCH 08/12] git-clone: support --path to do sparse clone Jeff King
2008-07-24 17:41 ` sparse fetch, was " Johannes Schindelin
2008-07-24 18:28 ` Jeff King
2008-07-25 0:09 ` Johannes Schindelin
2008-07-25 0:46 ` James Pickens
2008-07-25 0:49 ` sparse fetch, was Re: [PATCH 08/12] git-clone: support --path?to " Jeff King
2008-07-25 8:47 ` sparse fetch, was Re: [PATCH 08/12] git-clone: support --path to " Junio C Hamano
2008-07-25 8:54 ` Sverre Rabbelier
2008-07-24 18:44 ` Nguyen Thai Ngoc Duy
2008-07-24 18:53 ` Petr Baudis
2008-07-24 19:01 ` Sverre Rabbelier
2008-07-25 0:12 ` Johannes Schindelin
2008-07-25 0:42 ` Petr Baudis
2008-07-25 8:14 ` Sverre Rabbelier
2008-07-24 18:47 ` Nguyen Thai Ngoc Duy
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=20080723145549.GA29067@laptop \
--to=pclouds@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).