summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-22 21:00:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-22 21:00:25 (GMT)
commit3099d4faa3ffb888cddb3b1fbba8f13a52f6726c (patch)
treed834b89db16a1098ed5e299a2b6a543130bc3148 /builtin
parentd4bda9b0451fcc7f3fd485be2048cb731f7072ce (diff)
parent75555676ad3908b0f847a9ae154c35e12114c82f (diff)
downloadgit-3099d4faa3ffb888cddb3b1fbba8f13a52f6726c.zip
git-3099d4faa3ffb888cddb3b1fbba8f13a52f6726c.tar.gz
git-3099d4faa3ffb888cddb3b1fbba8f13a52f6726c.tar.bz2
Merge branch 'bc/clone-bare-with-conflicting-config'
"git -c core.bare=false clone --bare ..." would have segfaulted, which has been corrected. * bc/clone-bare-with-conflicting-config: builtin/init-db: handle bare clones when core.bare set to false
Diffstat (limited to 'builtin')
-rw-r--r--builtin/init-db.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index dcc45be..f82efe4 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -212,6 +212,7 @@ static int create_default_files(const char *template_path,
int reinit;
int filemode;
struct strbuf err = STRBUF_INIT;
+ const char *work_tree = get_git_work_tree();
/* Just look for `init.templatedir` */
init_db_template_dir = NULL; /* re-set in case it was set before */
@@ -235,7 +236,7 @@ static int create_default_files(const char *template_path,
* We must make sure command-line options continue to override any
* values we might have just re-read from the config.
*/
- is_bare_repository_cfg = init_is_bare_repository;
+ is_bare_repository_cfg = init_is_bare_repository || !work_tree;
if (init_shared_repository != -1)
set_shared_repository(init_shared_repository);
@@ -299,7 +300,6 @@ static int create_default_files(const char *template_path,
if (is_bare_repository())
git_config_set("core.bare", "true");
else {
- const char *work_tree = get_git_work_tree();
git_config_set("core.bare", "false");
/* allow template config file to override the default */
if (log_all_ref_updates == LOG_REFS_UNSET)