git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 02/12] git-grep: support --no-external-grep

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jul 24, 2008, 20:26 UTC
Message-ID
<20080724202634.GB3760@blimp.local>
In-Reply-To
<20080723145549.GA29067@laptop>
Nguyễn Thái Ngọc Duy, Wed, Jul 23, 2008 16:55:49 +0200:
>  
> +static int no_external_grep;
> +

If you have used direct logic instead of negative, your patch would have been simplier and the code would be easier to understand. I.e.:

+static int external_grep = 1;
Show 6 quoted lines
> @@ -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) {
+	if (!cached && external_grep) {
Show 8 quoted lines
> @@ -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("--no-external-grep", arg)) { + external_grep = 0; + continue; + }

BTW, how about a config option for this? And maybe --external-grep={yes|no}
Previous: Nguyễn Thái Ngọc DuyNext: Nguyen Thai Ngoc Duy
Message 2 of 3 in “git-grep: support --no-external-grep”
  1. 02/12 git-grep: support --no-external-grepNguyễn Thái Ngọc Duy, Jul 23, 2008
  2. Alex RiesenJul 24, 2008
  3. Nguyen Thai Ngoc DuyJul 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.