From eb0224c617ba6b4299f2a9f85d6c4b3b5e10abc0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 22 Nov 2016 13:37:04 -0800 Subject: archive: read local configuration Since b9605bc4f2 ("config: only read .git/config from configured repos", 2016-09-12), we do not read from ".git/config" unless we know we are in a repository. "git archive" however didn't do the repository discovery and instead relied on the old behaviour. Teach the command to run a "gentle" version of repository discovery so that local configuration variables are honoured. [jc: stole tests from peff] Signed-off-by: Junio C Hamano --- archive.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'archive.c') diff --git a/archive.c b/archive.c index dde1ab4c7..01751e574 100644 --- a/archive.c +++ b/archive.c @@ -504,15 +504,11 @@ static int parse_archive_args(int argc, const char **argv, } int write_archive(int argc, const char **argv, const char *prefix, - int setup_prefix, const char *name_hint, int remote) + const char *name_hint, int remote) { - int nongit = 0; const struct archiver *ar = NULL; struct archiver_args args; - if (setup_prefix && prefix == NULL) - prefix = setup_git_directory_gently(&nongit); - git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable); git_config(git_default_config, NULL); @@ -520,7 +516,7 @@ int write_archive(int argc, const char **argv, const char *prefix, init_zip_archiver(); argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote); - if (nongit) { + if (!startup_info->have_repository) { /* * We know this will die() with an error, so we could just * die ourselves; but its error message will be more specific -- cgit v1.2.1