X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-init-db.c;h=763fa55e76ef5b7e2f244f11199b5925382dac92;hb=154c7d0759b6885034bffa7a34d464d703fc8bb3;hp=af15cb27392dae6b16cee960908295ac252fe920;hpb=6adcca3fe84e6859fc62df6c4ab916192ca02795;p=git.git diff --git a/builtin-init-db.c b/builtin-init-db.c index af15cb273..763fa55e7 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -264,6 +264,21 @@ static int create_default_files(const char *git_dir, const char *template_path) if (work_tree != git_work_tree_cfg) git_config_set("core.worktree", work_tree); } + + /* Check if symlink is supported in the work tree */ + if (!reinit) { + path[len] = 0; + strcpy(path + len, "tXXXXXX"); + if (!close(xmkstemp(path)) && + !unlink(path) && + !symlink("testing", path) && + !lstat(path, &st1) && + S_ISLNK(st1.st_mode)) + unlink(path); /* good */ + else + git_config_set("core.symlinks", "false"); + } + return reinit; }