Commit de412fc2 by Patrick Steinhardt

tests: submodule: make use of sandboxes to clean repos

The test submodule::add::submodule_clone doesn't use a sandbox, and thus
the created repo will not get deleted after the test has finished.
Convert the test to use the empty standard repo sandbox instead to fix
this.
parent 09b1ac11
......@@ -187,28 +187,28 @@ void test_submodule_add__file_exists_in_index(void)
void test_submodule_add__submodule_clone(void)
{
git_index *index;
git_oid tree_id, commit_id;
git_submodule *sm;
git_signature *sig;
git_submodule *sm;
git_index *index;
cl_git_pass(git_repository_init(&g_repo, "willaddsubmodule-add", false));
g_repo = cl_git_sandbox_init("empty_standard_repo");
/* Create the submodule structure, clone into it and finalize */
cl_git_pass(git_submodule_add_setup(&sm, g_repo, cl_fixture("testrepo.git"), "testrepo-add", true));
cl_git_pass(git_submodule_clone(NULL, sm, NULL));
cl_git_pass(git_submodule_add_finalize(sm));
git_submodule_free(sm);
/* Create the submodule commit */
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_index_write_tree(&tree_id, index));
git_index_free(index);
cl_git_pass(git_signature_now(&sig, "Submoduler", "submoduler@local"));
cl_git_pass(git_commit_create_from_ids(&commit_id, g_repo, "HEAD", sig, sig, NULL, "A submodule\n",
&tree_id, 0, NULL));
git_signature_free(sig);
&tree_id, 0, NULL));
assert_submodule_exists(g_repo, "testrepo-add");
git_signature_free(sig);
git_submodule_free(sm);
git_index_free(index);
}
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