mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-20 11:44:31 +00:00
Failing test on git_checkout_tree when removing directories
This commit is contained in:
parent
d0951175d4
commit
c5df10f4aa
@ -48,6 +48,33 @@ void test_checkout_tree__can_checkout_a_subdirectory_from_a_commit(void)
|
|||||||
cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/fgh/1.txt"));
|
cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/fgh/1.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_checkout_tree__can_checkout_and_remove_directory(void)
|
||||||
|
{
|
||||||
|
git_reference *head;
|
||||||
|
cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
|
||||||
|
|
||||||
|
// Checkout brach "subtrees" and update HEAD, so that HEAD matches the current working tree
|
||||||
|
cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees"));
|
||||||
|
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
|
||||||
|
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
|
||||||
|
cl_git_pass(git_reference_symbolic_set_target(head, "refs/heads/subtrees"));
|
||||||
|
git_reference_free(head);
|
||||||
|
|
||||||
|
cl_assert_equal_i(true, git_path_isdir("./testrepo/ab/"));
|
||||||
|
cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/2.txt"));
|
||||||
|
cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/fgh/1.txt"));
|
||||||
|
|
||||||
|
// Checkout brach "master" and update HEAD, so that HEAD matches the current working tree
|
||||||
|
cl_git_pass(git_revparse_single(&g_object, g_repo, "master"));
|
||||||
|
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
|
||||||
|
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
|
||||||
|
cl_git_pass(git_reference_symbolic_set_target(head, "refs/heads/master"));
|
||||||
|
git_reference_free(head);
|
||||||
|
|
||||||
|
// This directory should no longer exist
|
||||||
|
cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
|
||||||
|
}
|
||||||
|
|
||||||
void test_checkout_tree__can_checkout_a_subdirectory_from_a_subtree(void)
|
void test_checkout_tree__can_checkout_a_subdirectory_from_a_subtree(void)
|
||||||
{
|
{
|
||||||
char *entries[] = { "de/" };
|
char *entries[] = { "de/" };
|
||||||
|
Loading…
Reference in New Issue
Block a user