Code

verify-pack: test for detection of index v2 object CRC mismatch
[git.git] / builtin-apply.c
index 10b1f88a3c05656af73ede98f9b5544a4e947731..c4978893122bbcfd80201fe937eb8433b29e1aa0 100644 (file)
@@ -1143,21 +1143,6 @@ static int parse_single_patch(char *line, unsigned long size, struct patch *patc
        if (patch->is_delete < 0 &&
            (newlines || (patch->fragments && patch->fragments->next)))
                patch->is_delete = 0;
-       if (!unidiff_zero || context) {
-               /* If the user says the patch is not generated with
-                * --unified=0, or if we have seen context lines,
-                * then not having oldlines means the patch is creation,
-                * and not having newlines means the patch is deletion.
-                */
-               if (patch->is_new < 0 && !oldlines) {
-                       patch->is_new = 1;
-                       patch->old_name = NULL;
-               }
-               if (patch->is_delete < 0 && !newlines) {
-                       patch->is_delete = 1;
-                       patch->new_name = NULL;
-               }
-       }
 
        if (0 < patch->is_new && oldlines)
                die("new file %s depends on old contents", patch->new_name);
@@ -3000,11 +2985,11 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
        return 0;
 }
 
-static int git_apply_config(const char *var, const char *value)
+static int git_apply_config(const char *var, const char *value, void *cb)
 {
        if (!strcmp(var, "apply.whitespace"))
                return git_config_string(&apply_default_whitespace, var, value);
-       return git_default_config(var, value);
+       return git_default_config(var, value, cb);
 }
 
 
@@ -3020,7 +3005,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 
        prefix = setup_git_directory_gently(&is_not_gitdir);
        prefix_length = prefix ? strlen(prefix) : 0;
-       git_config(git_apply_config);
+       git_config(git_apply_config, NULL);
        if (apply_default_whitespace)
                parse_whitespace_option(apply_default_whitespace);