diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-06-27 09:56:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-27 09:56:24 -0700 |
commit | fda65fadb6e98b5b8ea8058bbeaa29d983f335cb (patch) | |
tree | 01a4d9ee1f591fea9d34e0e6bfd22991050b520d /t/t7810-grep.sh | |
parent | Merge branch 'jk/rev-list-count-with-bitmap' into maint (diff) | |
parent | xdiff: fix merging of appended hunk with -W (diff) | |
download | tgif-fda65fadb6e98b5b8ea8058bbeaa29d983f335cb.tar.xz |
Merge branch 'rs/xdiff-hunk-with-func-line' into maint
"git show -W" (extend hunks to cover the entire function, delimited
by lines that match the "funcname" pattern) used to show the entire
file when a change added an entire function at the end of the file,
which has been fixed.
* rs/xdiff-hunk-with-func-line:
xdiff: fix merging of appended hunk with -W
grep: -W: don't extend context to trailing empty lines
t7810: add test for grep -W and trailing empty context lines
xdiff: don't trim common tail with -W
xdiff: -W: don't include common trailing empty lines in context
xdiff: ignore empty lines before added functions with -W
xdiff: handle appended chunks better with -W
xdiff: factor out match_func_rec()
t4051: rewrite, add more tests
Diffstat (limited to 't/t7810-grep.sh')
-rwxr-xr-x | t/t7810-grep.sh | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 1e72971a16..960425a4ec 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -9,7 +9,9 @@ test_description='git grep various. . ./test-lib.sh cat >hello.c <<EOF +#include <assert.h> #include <stdio.h> + int main(int argc, const char **argv) { printf("Hello world.\n"); @@ -715,6 +717,7 @@ test_expect_success 'grep -p' ' cat >expected <<EOF hello.c-#include <stdio.h> +hello.c- hello.c=int main(int argc, const char **argv) hello.c-{ hello.c- printf("Hello world.\n"); @@ -741,6 +744,16 @@ test_expect_success 'grep -W' ' ' cat >expected <<EOF +hello.c-#include <assert.h> +hello.c:#include <stdio.h> +EOF + +test_expect_success 'grep -W shows no trailing empty lines' ' + git grep -W stdio >actual && + test_cmp expected actual +' + +cat >expected <<EOF hello.c= printf("Hello world.\n"); hello.c: return 0; hello.c- /* char ?? */ @@ -1232,8 +1245,8 @@ test_expect_success 'grep --heading' ' cat >expected <<EOF <BOLD;GREEN>hello.c<RESET> -2:int main(int argc, const <BLACK;BYELLOW>char<RESET> **argv) -6: /* <BLACK;BYELLOW>char<RESET> ?? */ +4:int main(int argc, const <BLACK;BYELLOW>char<RESET> **argv) +8: /* <BLACK;BYELLOW>char<RESET> ?? */ <BOLD;GREEN>hello_world<RESET> 3:Hel<BLACK;BYELLOW>lo_w<RESET>orld @@ -1340,7 +1353,7 @@ test_expect_success 'grep --color -e A --and --not -e B with context' ' ' cat >expected <<EOF -hello.c-#include <stdio.h> +hello.c- hello.c=int main(int argc, const char **argv) hello.c-{ hello.c: pr<RED>int<RESET>f("<RED>Hello<RESET> world.\n"); |