From: Linus Torvalds Date: Mon, 15 May 2006 03:49:15 +0000 (-0700) Subject: builtin-grep: use external grep when we can take advantage of it X-Git-Tag: v1.4.1-rc1~108^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1e2398d7fad308dcc6019709244b40303b51b54d?hp=1e2398d7fad308dcc6019709244b40303b51b54d builtin-grep: use external grep when we can take advantage of it It's not perfect, but it gets the "git grep some-random-string" down to the good old half-a-second range for the kernel. It should convert more of the argument flags for "grep", that should be trivial to expand (I did a few just as an example). It should also bother to try to return the right "hit" value (which it doesn't, right now - the code is kind of there, but I didn't actually bother to do it _right_). Also, right now it _just_ limits by number of arguments, but it should also strictly speaking limit by total argument size (ie add up the length of the filenames, and do the "exec_grep()" flush call if it's bigger than some random value like 32kB). But I think that it's _conceptually_ doing all the right things, and it seems to work. So maybe somebody else can do some of the final polish. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano ---