From 046802d015b3be2e055ae68f29f76741023bc32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 2 Jul 2009 00:03:44 +0200 Subject: grep: print context hunk marks between files Print a hunk mark before matches from a new file are shown, in addition to the current behaviour of printing them if lines have been skipped. The result is easier to read, as (presumably unrelated) matches from different files are separated by a hunk mark. GNU grep does the same. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- t/t7002-grep.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 't') diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 7868af8f18..155bfdb7d7 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -155,6 +155,28 @@ test_expect_success 'grep -e A --and --not -e B' ' test_cmp expected actual ' +cat >expected <y-$a$b; done; done && + git add y-?? && + git grep -C1 "^[yz]" >actual && + test_cmp expected actual +' + +test_expect_success 'grep -C1 --no-ext-grep, hunk mark between files' ' + git grep -C1 --no-ext-grep "^[yz]" >actual && + test_cmp expected actual +' + test_expect_success 'log grep setup' ' echo a >>file && test_tick && -- cgit v1.2.3