Commit Diff


commit - a56c54fba369ff02d8234e7a81284a5216cc89bd
commit + 2dddf6cc4edd1ec53254fbfdaf60f49375f9b5fd
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;