From 822d9406c0b397bac7cfc4fda7b355aa1dd2cc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sun, 25 Sep 2016 10:14:40 +0700 Subject: init: kill git_link variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/init-db.c | 16 ++++------------ 1 file 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); -- cgit v1.2.3