From: René Scharfe Date: Sat, 28 May 2016 15:03:16 +0000 (+0200) Subject: xdiff: -W: don't include common trailing empty lines in context X-Git-Tag: v2.9.1~36^2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9e6a4cfc38aa81055d0b7d6fb94dc7b31809daa9?ds=sidebyside 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 Signed-off-by: Junio C Hamano --- diff --git a/t/t4051-diff-function-context.sh b/t/t4051-diff-function-context.sh index f7126fc245..17616fe582 100755 --- a/t/t4051-diff-function-context.sh +++ b/t/t4051-diff-function-context.sh @@ -85,7 +85,7 @@ test_expect_success ' context does not include preceding empty lines' ' test "$(first_context_line i1 + xche->chg1, xe->xdf1.nrec); + while (fe1 > 0 && is_empty_rec(&xe->xdf1, fe1 - 1)) + fe1--; if (fe1 < 0) fe1 = xe->xdf1.nrec; if (fe1 > e1) {