xdiff: -W: don't include common trailing empty lines in context
Empty lines between functions are shown by diff -W, as it considers them to be part of the function preceding them. They are not interesting in most languages. The previous patch stopped showing them in the special case of a function added at the end of a file. Stop extending context to those empty lines by skipping back over them from the start of the next function. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
392f6d3166
commit
9e6a4cfc38
@ -85,7 +85,7 @@ test_expect_success ' context does not include preceding empty lines' '
|
||||
test "$(first_context_line <changed_hello.diff)" != " "
|
||||
'
|
||||
|
||||
test_expect_failure ' context does not include trailing empty lines' '
|
||||
test_expect_success ' context does not include trailing empty lines' '
|
||||
test "$(last_context_line <changed_hello.diff)" != " "
|
||||
'
|
||||
|
||||
@ -103,7 +103,7 @@ test_expect_success ' context does not include other functions' '
|
||||
test $(grep -c "^[ +-].*Begin" changed_includes.diff) -le 1
|
||||
'
|
||||
|
||||
test_expect_failure ' context does not include trailing empty lines' '
|
||||
test_expect_success ' context does not include trailing empty lines' '
|
||||
test "$(last_context_line <changed_includes.diff)" != " "
|
||||
'
|
||||
|
||||
|
Reference in New Issue
Block a user