Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'archive.c')
-rw-r--r--archive.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/archive.c b/archive.c
index 42f2d2fdc8..2616676fc7 100644
--- a/archive.c
+++ b/archive.c
@@ -387,17 +387,27 @@ static int parse_archive_args(int argc, const char **argv,
int write_archive(int argc, const char **argv, const char *prefix,
int setup_prefix)
{
+ int nongit = 0;
const struct archiver *ar = NULL;
struct archiver_args args;
- argc = parse_archive_args(argc, argv, &ar, &args);
if (setup_prefix && prefix == NULL)
- prefix = setup_git_directory();
+ prefix = setup_git_directory_gently(&nongit);
+
+ git_config(git_default_config, NULL);
+
+ argc = parse_archive_args(argc, argv, &ar, &args);
+ if (nongit) {
+ /*
+ * We know this will die() with an error, so we could just
+ * die ourselves; but its error message will be more specific
+ * than what we could write here.
+ */
+ setup_git_directory();
+ }
parse_treeish_arg(argv, &args, prefix);
parse_pathspec_arg(argv + 1, &args);
- git_config(git_default_config, NULL);
-
return ar->write_archive(&args);
}