Commit 466d2e7a by Linquize

For bare repository, use repo_dir to test if symlinks are supported

parent 7568bdf4
...@@ -1606,6 +1606,7 @@ int git_repository_init_ext( ...@@ -1606,6 +1606,7 @@ int git_repository_init_ext(
{ {
int error; int error;
git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT; git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT;
const char *wd;
assert(out && given_repo && opts); assert(out && given_repo && opts);
...@@ -1615,6 +1616,7 @@ int git_repository_init_ext( ...@@ -1615,6 +1616,7 @@ int git_repository_init_ext(
if (error < 0) if (error < 0)
goto cleanup; goto cleanup;
wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_buf_cstr(&wd_path);
if (valid_repository_path(&repo_path)) { if (valid_repository_path(&repo_path)) {
if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) { if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
...@@ -1627,15 +1629,15 @@ int git_repository_init_ext( ...@@ -1627,15 +1629,15 @@ int git_repository_init_ext(
opts->flags |= GIT_REPOSITORY_INIT__IS_REINIT; opts->flags |= GIT_REPOSITORY_INIT__IS_REINIT;
error = repo_init_config( error = repo_init_config(
repo_path.ptr, wd_path.ptr, opts->flags, opts->mode); repo_path.ptr, wd, opts->flags, opts->mode);
/* TODO: reinitialize the templates */ /* TODO: reinitialize the templates */
} }
else { else {
if (!(error = repo_init_structure( if (!(error = repo_init_structure(
repo_path.ptr, wd_path.ptr, opts)) && repo_path.ptr, wd, opts)) &&
!(error = repo_init_config( !(error = repo_init_config(
repo_path.ptr, wd_path.ptr, opts->flags, opts->mode))) repo_path.ptr, wd, opts->flags, opts->mode)))
error = repo_init_create_head( error = repo_init_create_head(
repo_path.ptr, opts->initial_head); repo_path.ptr, opts->initial_head);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment