Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Fri, 20 Oct 2006 04:28:12 +0000 (21:28 -0700)
committerJunio C Hamano <junkio@cox.net>
Fri, 20 Oct 2006 04:28:12 +0000 (21:28 -0700)
* maint:
git-apply: prepare for upcoming GNU diff -u format change.

1  2 
builtin-apply.c
diff --combined builtin-apply.c
index 0bdcf63904a8c6763b316159ee139691bc04f972,11a5277a69f4cb5c02fb8c9a9312ebafdc472028..11397f5504f98ccff47a90b228abc71b30327fb9
@@@ -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;
                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);