From: Linus Torvalds Date: Sat, 25 Mar 2006 15:56:03 +0000 (-0800) Subject: builtin-diff: \No newline at end of file. X-Git-Tag: v1.3.0-rc1~2^2~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=621c53cc082299eaf69e9f2dc0274547c7d87fb0;p=git.git builtin-diff: \No newline at end of file. Signed-off-by: Junio C Hamano --- diff --git a/xdiff/xutils.c b/xdiff/xutils.c index 01e6765e..b68afa25 100644 --- a/xdiff/xutils.c +++ b/xdiff/xutils.c @@ -31,14 +31,22 @@ 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; }