Commit Diff


commit - fa9997e790c81002782c0bb2747fa2050576dbb3
commit + 34b3c35b08058d7664122b8f9c0bf226e68b5fc4
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;