Code

Merge branch 'cf/maint-remote-uploadpack-useconfig-fix'
[git.git] / builtin-apply.c
index ebbf084639e07a398ea6de62d5d135faabbd1bd4..4cf819c7905d5997a6ce2a89b4ecce1176a4b045 100644 (file)
@@ -2614,7 +2614,7 @@ static int get_current_sha1(const char *path, unsigned char *sha1)
 static void build_fake_ancestor(struct patch *list, const char *filename)
 {
        struct patch *patch;
-       struct index_state result = { 0 };
+       struct index_state result = { NULL };
        int fd;
 
        /* Once we start supporting the reverse patch, it may be
@@ -3277,9 +3277,11 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
                OPT_BOOLEAN(0, "stat", &diffstat,
                        "instead of applying the patch, output diffstat for the input"),
                { OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary,
-                 NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
+                 NULL, "old option, now no-op",
+                 PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
                { OPTION_BOOLEAN, 0, "binary", &binary,
-                 NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
+                 NULL, "old option, now no-op",
+                 PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
                OPT_BOOLEAN(0, "numstat", &numstat,
                        "shows number of added and deleted lines in decimal notation"),
                OPT_BOOLEAN(0, "summary", &summary,
@@ -3292,7 +3294,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
                        "apply a patch without touching the working tree"),
                OPT_BOOLEAN(0, "apply", &force_apply,
                        "also apply the patch (use with --stat/--summary/--check)"),
-               OPT_STRING(0, "build-fake-ancestor", &fake_ancestor, "file",
+               OPT_FILENAME(0, "build-fake-ancestor", &fake_ancestor,
                        "build a temporary index based on embedded index information"),
                { OPTION_CALLBACK, 'z', NULL, NULL, NULL,
                        "paths are separated with NUL character",
@@ -3327,11 +3329,8 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
        if (apply_default_whitespace)
                parse_whitespace_option(apply_default_whitespace);
 
-       argc = parse_options(argc, argv, builtin_apply_options,
+       argc = parse_options(argc, argv, prefix, builtin_apply_options,
                        apply_usage, 0);
-       fake_ancestor = parse_options_fix_filename(prefix, fake_ancestor);
-       if (fake_ancestor)
-               fake_ancestor = xstrdup(fake_ancestor);
 
        if (apply_with_reject)
                apply = apply_verbosely = 1;