mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-03 01:58:32 +00:00
repository: make initialization cope with missing core.worktree
This commit is contained in:
parent
319ad0ba20
commit
89cd5708d9
@ -777,8 +777,8 @@ static int repo_init_config(
|
|||||||
SET_REPO_CONFIG(string, "core.worktree", work_dir);
|
SET_REPO_CONFIG(string, "core.worktree", work_dir);
|
||||||
}
|
}
|
||||||
else if ((opts->flags & GIT_REPOSITORY_INIT__IS_REINIT) != 0) {
|
else if ((opts->flags & GIT_REPOSITORY_INIT__IS_REINIT) != 0) {
|
||||||
if ((error = git_config_delete(config, "core.worktree")) < 0)
|
if (git_config_delete(config, "core.worktree") < 0)
|
||||||
goto cleanup;
|
giterr_clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!are_symlinks_supported(repo_dir))
|
if (!are_symlinks_supported(repo_dir))
|
||||||
|
@ -378,3 +378,18 @@ void test_repo_init__extended_with_template(void)
|
|||||||
|
|
||||||
cleanup_repository("templated.git");
|
cleanup_repository("templated.git");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_repo_init__can_reinit_an_initialized_repository(void)
|
||||||
|
{
|
||||||
|
git_repository *reinit;
|
||||||
|
|
||||||
|
cl_git_pass(git_futils_mkdir("extended", NULL, 0775, 0));
|
||||||
|
cl_git_pass(git_repository_init(&_repo, "extended", false));
|
||||||
|
|
||||||
|
cl_git_pass(git_repository_init(&reinit, "extended", false));
|
||||||
|
|
||||||
|
cl_assert_equal_s(git_repository_path(_repo), git_repository_path(reinit));
|
||||||
|
|
||||||
|
git_repository_free(reinit);
|
||||||
|
cleanup_repository("extended");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user