summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3443546)
raw | patch | inline | side by side (parent: 3443546)
author | Linus Torvalds <torvalds@osdl.org> | |
Sat, 25 Mar 2006 15:56:03 +0000 (07:56 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 26 Mar 2006 00:49:59 +0000 (16:49 -0800) |
Signed-off-by: Junio C Hamano <junkio@cox.net>
xdiff/xutils.c | patch | blob | history |
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index 01e6765e3dd584c582211061427c9218fc683ae4..b68afa25c1d6e285005b2b84472b2faf62883a9d 100644 (file)
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
xdemitcb_t *ecb) {
- mmbuffer_t mb[2];
+ mmbuffer_t mb[3];
+ int i;
mb[0].ptr = (char *) pre;
mb[0].size = psize;
mb[1].ptr = (char *) rec;
mb[1].size = size;
+ i = 2;
- if (ecb->outf(ecb->priv, mb, 2) < 0) {
+ if (!size || rec[size-1] != '\n') {
+ mb[2].ptr = "\n\\ No newline at end of file\n";
+ mb[2].size = strlen(mb[2].ptr);
+ i = 3;
+ }
+
+ if (ecb->outf(ecb->priv, mb, i) < 0) {
return -1;
}