summaryrefslogtreecommitdiff
path: root/builtin/init-db.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/init-db.c')
-rw-r--r--builtin/init-db.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 78aa387..c7c76bb 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -266,7 +266,7 @@ static int create_default_files(const char *template_path)
/* allow template config file to override the default */
if (log_all_ref_updates == -1)
git_config_set("core.logallrefupdates", "true");
- if (prefixcmp(git_dir, work_tree) ||
+ if (!starts_with(git_dir, work_tree) ||
strcmp(git_dir + strlen(work_tree), "/.git")) {
git_config_set("core.worktree", work_tree);
}
@@ -515,13 +515,14 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
saved = shared_repository;
shared_repository = 0;
switch (safe_create_leading_directories_const(argv[0])) {
- case -3:
+ case SCLD_OK:
+ case SCLD_PERMS:
+ break;
+ case SCLD_EXISTS:
errno = EEXIST;
/* fallthru */
- case -1:
- die_errno(_("cannot mkdir %s"), argv[0]);
- break;
default:
+ die_errno(_("cannot mkdir %s"), argv[0]);
break;
}
shared_repository = saved;