Commit Diff


commit - 35d04818407d29f2e9de1c0630db561cf783d6fa
commit + b5a9c15f4d68c06ec3bf839529b3ed2def0a6af6
blob - 9b8e02dc9f20f06d14deba7d2ac739a0a2f8f20a
blob + d480a022a9a7f6f34727545b82a0461ebf1446ae
--- lib/diff_output_unidiff.c
+++ lib/diff_output_unidiff.c
@@ -404,10 +404,12 @@ output_unidiff_chunk(struct diff_output_info *outinfo,
 		if (rc)
 			return rc;
 
-		rc = diff_output_trailing_newline_msg(outinfo, dest,
-				&result->chunks.head[result->chunks.len - 1]);
-		if (rc != DIFF_RC_OK)
-			return rc;
+		if (cc->left.end == result->left->atoms.len) {
+			rc = diff_output_trailing_newline_msg(outinfo, dest,
+			    &result->chunks.head[result->chunks.len - 1]);
+			if (rc != DIFF_RC_OK)
+				return rc;
+		}
 	}
 
 	return DIFF_RC_OK;