summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-09-25 03:14:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-25 23:32:35 (GMT)
commit822d9406c0b397bac7cfc4fda7b355aa1dd2cc52 (patch)
treeeee59d77e626ae392ceb0c87465fe7a91251f5bb /builtin
parent6311cfaf93716bcc43dd1151cb1763e3f80d8099 (diff)
downloadgit-822d9406c0b397bac7cfc4fda7b355aa1dd2cc52.zip
git-822d9406c0b397bac7cfc4fda7b355aa1dd2cc52.tar.gz
git-822d9406c0b397bac7cfc4fda7b355aa1dd2cc52.tar.bz2
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')
-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 8069cd2..37e318b 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);