summaryrefslogtreecommitdiff
path: root/builtin/init-db.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-09-25 10:14:40 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-09-25 16:32:35 -0700
commit822d9406c0b397bac7cfc4fda7b355aa1dd2cc52 (patch)
treeeee59d77e626ae392ceb0c87465fe7a91251f5bb /builtin/init-db.c
parentinit: do not set unnecessary core.worktree (diff)
downloadtgif-822d9406c0b397bac7cfc4fda7b355aa1dd2cc52.tar.xz
init: kill git_link variable
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/init-db.c')
-rw-r--r--builtin/init-db.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 8069cd2e62..37e318b116 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -22,7 +22,6 @@
static int init_is_bare_repository = 0;
static int init_shared_repository = -1;
static const char *init_db_template_dir;
-static const char *git_link;
static void copy_templates_1(struct strbuf *path, struct strbuf *template,
DIR *dir)
@@ -312,7 +311,7 @@ static void create_object_directory(void)
strbuf_release(&path);
}
-static void separate_git_dir(const char *git_dir)
+static void separate_git_dir(const char *git_dir, const char *git_link)
{
struct stat st;
@@ -349,22 +348,15 @@ int init_db(const char *git_dir, const char *real_git_dir,
if (!exist_ok && !stat(real_git_dir, &st))
die(_("%s already exists"), real_git_dir);
- /*
- * make sure symlinks are resolved because we'll be
- * moving the target repo later on in separate_git_dir()
- */
- git_link = xstrdup(real_path(git_dir));
set_git_dir(real_path(real_git_dir));
+ git_dir = get_git_dir();
+ separate_git_dir(git_dir, original_git_dir);
}
else {
set_git_dir(real_path(git_dir));
- git_link = NULL;
+ git_dir = get_git_dir();
}
startup_info->have_repository = 1;
- git_dir = get_git_dir();
-
- if (git_link)
- separate_git_dir(git_dir);
safe_create_dir(git_dir, 0);