Subject: Re: [PATCH 10/16] add NO_EXTERNAL_GREP build option

From: Junio C Hamano <[email-masked]>
Date: Wed, 12 Mar 2008 15:30:05 -0700

Jeff King <[email-masked]> writes:

> Previously, we just chose whether to allow external grep
> based on the __unix__ define. However, there are systems
> which define this macro but which have an inferior group
> (e.g., one that does not support all options used by t7002).
> This allows users to accept the potential speed penalty to
> get a more consistent grep experience (and to pass the
> testsuite).
>
> Signed-off-by: Jeff King <[email-masked]>
> ---
> This might have fallouts for msysgit (i.e., they need to define
> NO_EXTERNAL_GREP instead of relying on __unix__ not being defined).
> ...
> diff --git a/builtin-grep.c b/builtin-grep.c
> index f4f4ecb..f215b28 100644
> --- a/builtin-grep.c
> +++ b/builtin-grep.c
> @@ -153,7 +153,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
>  	return i;
>  }
>  
> -#ifdef __unix__
> +#ifndef NO_EXTERNAL_GREP

Perhaps place

    #ifndef NO_EXTERNAL_GREP
    #ifndef __unix__
    #define NO_EXTERNAL_GREP 1
    #else
    #define NO_EXTERNAL_GREP 0
    #endif
    #endif

in git-compat-util.h, and make the in-code reference to

    #if NO_EXTERNAL_GREP
            ... optimization using external grep ...
    #endif