var: run setup_git_directory_gently() sooner
[gitweb.git] / builtin / apply.c
index 12ef9ea8afb0aa1e554e3ce6c6085e97ff7e7466..f005ba1e8934d4383f6181737a53a388d8b03a61 100644 (file)
@@ -3607,11 +3607,11 @@ static int option_parse_directory(const struct option *opt,
        return 0;
 }
 
-int cmd_apply(int argc, const char **argv, const char *unused_prefix)
+int cmd_apply(int argc, const char **argv, const char *prefix_)
 {
        int i;
        int errs = 0;
-       int is_not_gitdir;
+       int is_not_gitdir = !startup_info->have_repository;
        int binary;
        int force_apply = 0;
 
@@ -3684,7 +3684,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
                OPT_END()
        };
 
-       prefix = setup_git_directory_gently(&is_not_gitdir);
+       prefix = prefix_;
        prefix_length = prefix ? strlen(prefix) : 0;
        git_config(git_apply_config, NULL);
        if (apply_default_whitespace)