From f76d947ae13ca66790a305a58764ae50ea7442d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 11 Mar 2014 22:15:49 +0100 Subject: grep: support -h (no header) with --count Suppress printing the header (filename) with -h even if in -c/--count mode. GNU grep and OpenBSD's grep do the same. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- t/t7810-grep.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't') diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 46aaebc47..63b303924 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -328,6 +328,18 @@ do grep "a+b*c" $H ab >actual && test_cmp expected actual ' + + test_expect_success "grep --count $L" ' + echo ${HC}ab:3 >expected && + git grep --count -e b $H -- ab >actual && + test_cmp expected actual + ' + + test_expect_success "grep --count -h $L" ' + echo 3 >expected && + git grep --count -h -e b $H -- ab >actual && + test_cmp expected actual + ' done cat >expected <