Skip to content

Commit

Permalink
builtin-diff: \No newline at end of file.
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Mar 26, 2006
1 parent 3443546 commit 621c53c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions xdiff/xutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 621c53c

Please sign in to comment.