Skip to contentSkip to conversation

Fix the result of "git grep [-l|-L] -C <num>"

PATCH New Albert Yale 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Fix the result of "git grep [-l|-L] -C <num>"

When combining "git grep [-l|-L]" with "-C <num>", the first result is omitted.

---
 builtin/grep.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
builtin/grep.c +4 -1
index 9ce064a..beebe20 100644
@@ -1036,7 +1036,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	if (use_threads) {
 		if (opt.pre_context || opt.post_context || opt.file_break ||
 		    opt.funcbody)
-			skip_first_line = 1;
+		{
+			if( ! ( opt.name_only || opt.unmatch_name_only ) )
+				skip_first_line = 1;
+		}
 		start_threads(&opt);
 	}
 #endif
Signature · 1 line
1.7.8.3