Code

tests: shell negation portability fix
[git.git] / builtin-apply.c
index 74f7e79241b1f8192ad00af39571ef59a796b8af..e9d49f133afd559d2df3f09997c08a61dfc2ff86 100644 (file)
@@ -810,6 +810,13 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch
         * the default name from the header.
         */
        patch->def_name = git_header_name(line, len);
+       if (patch->def_name && root) {
+               char *s = xmalloc(root_len + strlen(patch->def_name) + 1);
+               strcpy(s, root);
+               strcpy(s + root_len, patch->def_name);
+               free(patch->def_name);
+               patch->def_name = s;
+       }
 
        line += len;
        size -= len;