mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-30 16:43:16 +00:00
For bare repository, use repo_dir to test if symlinks are supported
This commit is contained in:
parent
7568bdf4ab
commit
466d2e7a5f
@ -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(
|
|||||||
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(
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user