aboutsummaryrefslogtreecommitdiff
path: root/t/t7810-grep.sh
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-03-11 22:15:49 +0100
committerJunio C Hamano <gitster@pobox.com>2014-03-11 15:05:28 -0700
commitf76d947ae13ca66790a305a58764ae50ea7442d9 (patch)
tree05dacbd22bc11c585b0b6dbe058af4283c3fdf05 /t/t7810-grep.sh
parent9afad7a1e6363ed249a5cfcc95a35900ae4970cb (diff)
downloadgit-f76d947ae13ca66790a305a58764ae50ea7442d9.tar.gz
git-f76d947ae13ca66790a305a58764ae50ea7442d9.tar.xz
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>
Diffstat (limited to 't/t7810-grep.sh')
-rwxr-xr-xt/t7810-grep.sh12
1 files changed, 12 insertions, 0 deletions
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 <<EOF