Commit c5df10f4 by Jameson Miller Committed by Russell Belfer

Failing test on git_checkout_tree when removing directories

parent d0951175
......@@ -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"));
}
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)
{
char *entries[] = { "de/" };
......
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