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

Fix silly typo in new builtin grep

From
Linus Torvalds <torvalds@osdl.org>
Date
May 16, 2006, 00:54 UTC
Message-ID
<Pine.LNX.4.64.0605151743360.3866@g5.osdl.org>

The "-F" flag apparently got mis-translated due to some over-eager copy-paste work into a duplicate "-H" when using the external grep.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
Me likee the new built-in grep. The ability to say
	git grep __make_request v2.6.13 -- '*.c'

to grep for it in a specific version is well worth the fact that it obviously ends up being slower than grepping in the currently checked-out tree. It's doing a hell of a lot more, but despite that it's not at all that slow.

(In fact, I would say that doing the above command in just 4 seconds is damn impressive - it's a large code-base, and v2.6.13 is several months, and over 20 _thousand_ revisions ago).

And now it doesn't have any performance downsides, so it's all upside. 

Good job. Pls merge into mainline, I think the "grep per revision" is a killer feature.

diff --git a/builtin-grep.c b/builtin-grep.c
index 3d6e515..66111de 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -455,7 +455,7 @@ static int external_grep(struct grep_opt
 	push_arg("grep");
 	push_arg("-H");
 	if (opt->fixed)
-		push_arg("-H");
+		push_arg("-F");
 	if (opt->linenum)
 		push_arg("-n");
 	if (opt->regflags & REG_EXTENDED)
Next: Linus Torvalds
Message 1 of 6 in “Fix silly typo in new builtin grep”
  1. Linus TorvaldsMay 16, 2006
  2. Linus TorvaldsMay 16, 2006
  3. Morten WelinderMay 16, 2006
  4. Linus TorvaldsMay 16, 2006
  5. Junio C HamanoMay 16, 2006
  6. Linus TorvaldsMay 16, 2006

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.