grep: show non-empty lines before functions with -W
commita5dc20b0701cee53b2c37a4aa3a339b48d5bb298
authorRené Scharfe <l.s.r@web.de>
Sat, 18 Nov 2017 18:08:08 +0000 (18 19:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Nov 2017 00:36:06 +0000 (21 09:36 +0900)
treea77c5e843d10486bb70eea127cceadad419f159a
parent6653a01bf2dd1e2aabbcf1f83269bd75737acc94
grep: show non-empty lines before functions with -W

Non-empty lines before a function definition are most likely comments
for that function and thus relevant.  Include them in function context.

Such a non-empty line might also belong to the preceding function if
there is no separating blank line.  Stop extending the context upwards
also at the next function line to make sure only one extra function body
is shown at most.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c
t/t7810-grep.sh