Browse Source

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>
maint
Nguyễn Thái Ngọc Duy 8 years ago committed by Junio C Hamano
parent
commit
822d9406c0
  1. 16
      builtin/init-db.c

16
builtin/init-db.c

@ -22,7 +22,6 @@ @@ -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) @@ -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, @@ -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);


Loading…
Cancel
Save