diff --git a/lib/diff_output_unidiff.c b/lib/diff_output_unidiff.c index 74b22eb..470302a 100644 --- a/lib/diff_output_unidiff.c +++ b/lib/diff_output_unidiff.c @@ -391,6 +391,11 @@ output_unidiff_chunk(struct diff_output_info *outinfo, FILE *dest, cc->left.end - chunk_end_line); if (rc) return rc; + rc = diff_output_trailing_newline_msg(outinfo, dest, + &result->chunks.head[cc->chunk.end]); + if (rc != DIFF_RC_OK) + return rc; + } return DIFF_RC_OK; diff --git a/test/expect125.diff b/test/expect125.diff new file mode 100644 index 0000000..dc9ca80 --- /dev/null +++ b/test/expect125.diff @@ -0,0 +1,12 @@ +--- test125.left.txt ++++ test125.right.txt +@@ -1,7 +1,7 @@ + This is a test + of missing trailing new lines + in context +-this line has a change ++this line has the change + this is the same + this is too + and this one +\ No newline at end of file diff --git a/test/test125.left.txt b/test/test125.left.txt new file mode 100644 index 0000000..ecce2a6 --- /dev/null +++ b/test/test125.left.txt @@ -0,0 +1,7 @@ +This is a test +of missing trailing new lines +in context +this line has a change +this is the same +this is too +and this one \ No newline at end of file diff --git a/test/test125.right.txt b/test/test125.right.txt new file mode 100644 index 0000000..1242106 --- /dev/null +++ b/test/test125.right.txt @@ -0,0 +1,7 @@ +This is a test +of missing trailing new lines +in context +this line has the change +this is the same +this is too +and this one \ No newline at end of file