From: Junio C Hamano Date: Fri, 20 Oct 2006 04:28:12 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.4.4-rc1~81 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e19343ad547e32aaf511b0b38be083e1b3145d4e?ds=inline;hp=-c Merge branch 'maint' * maint: git-apply: prepare for upcoming GNU diff -u format change. --- e19343ad547e32aaf511b0b38be083e1b3145d4e diff --combined builtin-apply.c index 0bdcf63904,11a5277a69..11397f5504 --- a/builtin-apply.c +++ b/builtin-apply.c @@@ -360,7 -360,7 +360,7 @@@ static int gitdiff_hdrend(const char *l static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, const char *oldnew) { if (!orig_name && !isnull) - return find_name(line, NULL, 1, 0); + return find_name(line, NULL, 1, TERM_TAB); if (orig_name) { int len; @@@ -370,7 -370,7 +370,7 @@@ len = strlen(name); if (isnull) die("git-apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr); - another = find_name(line, NULL, 1, 0); + another = find_name(line, NULL, 1, TERM_TAB); if (!another || memcmp(another, name, len)) die("git-apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr); free(another); @@@ -934,6 -934,7 +934,7 @@@ static int parse_fragment(char *line, u switch (*line) { default: return -1; + case '\n': /* newer GNU diff, an empty context line */ case ' ': oldlines--; newlines--; @@@ -1623,6 -1624,14 +1624,14 @@@ static int apply_one_fragment(struct bu 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);