summaryrefslogtreecommitdiff
path: root/xdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-03-25 15:56:03 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-03-26 00:49:59 (GMT)
commit621c53cc082299eaf69e9f2dc0274547c7d87fb0 (patch)
treebed284eda2fe671dd67325a26ca6334dfa1b220e /xdiff
parent3443546f6ef57fe28ea5cca232df8e400bfc3883 (diff)
downloadgit-621c53cc082299eaf69e9f2dc0274547c7d87fb0.zip
git-621c53cc082299eaf69e9f2dc0274547c7d87fb0.tar.gz
git-621c53cc082299eaf69e9f2dc0274547c7d87fb0.tar.bz2
builtin-diff: \No newline at end of file.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'xdiff')
-rw-r--r--xdiff/xutils.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index 01e6765e..b68afa2 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;
}