summaryrefslogtreecommitdiff
path: root/t/t7810-grep.sh
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2011-06-05 17:24:25 +0200
committerJunio C Hamano <gitster@pobox.com>2011-06-05 18:15:26 -0700
commita8f0e7649eba3ce78e1f09fc4dcbb2c3fcc3d866 (patch)
tree5076f16de30d3761802d5dfa241054662fb5b8c7 /t/t7810-grep.sh
parent08303c3636ef750bfafd1c47f363120cb439b367 (diff)
downloadgit-a8f0e7649eba3ce78e1f09fc4dcbb2c3fcc3d866.tar.gz
grep: add --break
With --break, an empty line is printed between matches from different files, increasing readability. This option is taken from ack (http://betterthangrep.com/). Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7810-grep.sh')
-rwxr-xr-xt/t7810-grep.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 539a8fe6e9..f55793e3cb 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -746,4 +746,32 @@ test_expect_success 'grep --color, separator' '
test_cmp expected actual
'
+cat >expected <<EOF
+hello.c:int main(int argc, const char **argv)
+hello.c: /* char ?? */
+
+hello_world:Hello_world
+EOF
+
+test_expect_success 'grep --break' '
+ git grep --break -e char -e lo_w hello.c hello_world >actual &&
+ test_cmp expected actual
+'
+
+cat >expected <<EOF
+hello.c:int main(int argc, const char **argv)
+hello.c-{
+--
+hello.c: /* char ?? */
+hello.c-}
+
+hello_world:Hello_world
+hello_world-HeLLo_world
+EOF
+
+test_expect_success 'grep --break with context' '
+ git grep --break -A1 -e char -e lo_w hello.c hello_world >actual &&
+ test_cmp expected actual
+'
+
test_done