diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-08-08 10:41:19 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-08 10:41:19 -0700 |
| commit | 984ab1133776344537eacf4a27c8d8b8a6af010d (patch) | |
| tree | 68ac79451826b7ce596cbb2a9d156d6e4c73f960 | |
| parent | Merge branch 'dd/notes-empty-no-edit-by-default' (diff) | |
| parent | grep: -W: skip trailing empty lines at EOF, too (diff) | |
| download | git-984ab1133776344537eacf4a27c8d8b8a6af010d.tar.gz git-984ab1133776344537eacf4a27c8d8b8a6af010d.zip | |
Merge branch 'rs/grep-omit-blank-lines-after-function-at-eof'
"git grep -W" omits blank lines that follow the found function at
the end of the file, just like it omits blank lines before the next
function.
* rs/grep-omit-blank-lines-after-function-at-eof:
grep: -W: skip trailing empty lines at EOF, too
| -rw-r--r-- | grep.c | 3 | ||||
| -rwxr-xr-x | t/t7810-grep.sh | 1 |
2 files changed, 3 insertions, 1 deletions
@@ -1735,7 +1735,8 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle peek_eol = end_of_line(peek_bol, &peek_left); } - if (match_funcname(opt, gs, peek_bol, peek_eol)) + if (peek_bol >= gs->buf + gs->size || + match_funcname(opt, gs, peek_bol, peek_eol)) show_function = 0; } if (show_function || diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 875dcfd98f..af2cf2f78a 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -31,6 +31,7 @@ int main(int argc, const char **argv) return 0; /* char ?? */ } + EOF test_expect_success setup ' |
