diff options
author | Junio C Hamano <junkio@cox.net> | 2006-10-20 08:28:12 +0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-10-20 08:28:12 +0400 |
commit | e19343ad547e32aaf511b0b38be083e1b3145d4e (patch) | |
tree | bb2001ed8cb2b4857f5694f80a108bdb1e9fecb9 /builtin-apply.c | |
parent | 7768e27e1d3f3d5e253e795433033b5de1d1c157 (diff) | |
parent | b507b465f7831612b9d9fc643e3e5218b64e5bfa (diff) |
Merge branch 'maint'
* maint:
git-apply: prepare for upcoming GNU diff -u format change.
Diffstat (limited to 'builtin-apply.c')
-rw-r--r-- | builtin-apply.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin-apply.c b/builtin-apply.c index 0bdcf63904..11397f5504 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -934,6 +934,7 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s switch (*line) { default: return -1; + case '\n': /* newer GNU diff, an empty context line */ case ' ': oldlines--; newlines--; @@ -1623,6 +1624,14 @@ static int apply_one_fragment(struct buffer_desc *desc, struct fragment *frag, i first = '-'; } switch (first) { + case '\n': + /* Newer GNU diff, empty context line */ + if (plen < 0) + /* ... followed by '\No newline'; nothing */ + break; + old[oldsize++] = '\n'; + new[newsize++] = '\n'; + break; case ' ': case '-': memcpy(old + oldsize, patch + 1, plen); |