X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin-grep.c;h=ef299108f529fa5fa931d765828f04535c3a6351;hb=3562198b7da7ef6597af27b3a7fcaeee41608999;hp=9180b39e3f22e5d3805649c655c61aafc7861968;hpb=c21fdf3b60884222d5d28a09d854cef83c3e60ac;p=git.git diff --git a/builtin-grep.c b/builtin-grep.c index 9180b39e3..ef299108f 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -12,6 +12,14 @@ #include "builtin.h" #include "grep.h" +#ifndef NO_EXTERNAL_GREP +#ifdef __unix__ +#define NO_EXTERNAL_GREP 0 +#else +#define NO_EXTERNAL_GREP 1 +#endif +#endif + /* * git grep pathspecs are somewhat different from diff-tree pathspecs; * pathname wildcards are allowed. @@ -153,7 +161,7 @@ static int grep_file(struct grep_opt *opt, const char *filename) return i; } -#ifdef __unix__ +#if !NO_EXTERNAL_GREP static int exec_grep(int argc, const char **argv) { pid_t pid; @@ -372,7 +380,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached) int nr; read_cache(); -#ifdef __unix__ +#if !NO_EXTERNAL_GREP /* * Use the external "grep" command for the case where * we grep through the checked-out files. It tends to @@ -578,6 +586,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) continue; } if (!strcmp("-l", arg) || + !strcmp("--name-only", arg) || !strcmp("--files-with-matches", arg)) { opt.name_only = 1; continue;