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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
9afad7a1e6
commit
f76d947ae1
@ -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 <<EOF
|
||||
|
Reference in New Issue
Block a user