• Adam Butcher's avatar
    Fix '\ No newline...' annotation in rewrite diffs · 35e2d03c
    Adam Butcher authored
    When a file that ends with an incomplete line is expressed as a
    complete rewrite with the -B option, git diff incorrectly
    appends the incomplete line indicator "\ No newline at end of
    file" after such a line, rather than writing it on a line of its
    own (the output codepath for normal output without -B does not
    have this problem).  Add a LF after the incomplete line before
    writing the "\ No newline ..." out to fix this.
    
    Add a couple of tests to confirm that the indicator comment is
    generated on its own line in both plain diff and rewrite mode.
    Signed-off-by: default avatarAdam Butcher <dev.lists@jessamine.co.uk>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    35e2d03c
t4022-diff-rewrite.sh 1.99 KB