本文整理汇总了C++中cl_fixture_cleanup函数的典型用法代码示例。如果您正苦于以下问题:C++ cl_fixture_cleanup函数的具体用法?C++ cl_fixture_cleanup怎么用?C++ cl_fixture_cleanup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cl_fixture_cleanup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_network_remote_local__update_tips_for_new_remote
void test_network_remote_local__update_tips_for_new_remote(void) {
git_repository *src_repo;
git_repository *dst_repo;
git_remote *new_remote;
git_reference* branch;
/* Copy test repo */
cl_fixture_sandbox("testrepo.git");
cl_git_pass(git_repository_open(&src_repo, "testrepo.git"));
/* Set up an empty bare repo to push into */
cl_git_pass(git_repository_init(&dst_repo, "./localbare.git", 1));
/* Push to bare repo */
cl_git_pass(git_remote_create(&new_remote, src_repo, "bare", "./localbare.git"));
cl_git_pass(git_remote_push(new_remote, &push_array, NULL));
/* Make sure remote branch has been created */
cl_git_pass(git_branch_lookup(&branch, src_repo, "bare/master", GIT_BRANCH_REMOTE));
git_reference_free(branch);
git_remote_free(new_remote);
git_repository_free(dst_repo);
cl_fixture_cleanup("localbare.git");
git_repository_free(src_repo);
cl_fixture_cleanup("testrepo.git");
}
示例2: test_diff_submodules__cleanup
void test_diff_submodules__cleanup(void)
{
cl_git_sandbox_cleanup();
cl_fixture_cleanup("testrepo.git");
cl_fixture_cleanup("submod2_target");
}
示例3: test_online_clone__bitbucket_style
void test_online_clone__bitbucket_style(void)
{
git_cred_userpass_payload user_pass = {
"libgit2", "libgit2"
};
g_options.fetch_opts.callbacks.credentials = git_cred_userpass;
g_options.fetch_opts.callbacks.payload = &user_pass;
cl_git_pass(git_clone(&g_repo, BB_REPO_URL, "./foo", &g_options));
git_repository_free(g_repo); g_repo = NULL;
cl_fixture_cleanup("./foo");
/* User and pass from URL */
user_pass.password = "wrong";
cl_git_pass(git_clone(&g_repo, BB_REPO_URL_WITH_PASS, "./foo", &g_options));
git_repository_free(g_repo); g_repo = NULL;
cl_fixture_cleanup("./foo");
/* Wrong password in URL, fall back to user_pass */
user_pass.password = "libgit2";
cl_git_pass(git_clone(&g_repo, BB_REPO_URL_WITH_WRONG_PASS, "./foo", &g_options));
git_repository_free(g_repo); g_repo = NULL;
cl_fixture_cleanup("./foo");
}
示例4: test_repo_setters__cleanup
void test_repo_setters__cleanup(void)
{
git_repository_free(repo);
repo = NULL;
cl_fixture_cleanup("testrepo.git");
cl_fixture_cleanup("new_workdir");
}
示例5: test_index_tests__add_invalid_filename
/* Test that writing an invalid filename fails */
void test_index_tests__add_invalid_filename(void)
{
git_repository *repo;
p_mkdir("invalid", 0700);
cl_git_pass(git_repository_init(&repo, "./invalid", 0));
cl_must_pass(p_mkdir("./invalid/subdir", 0777));
/* cl_git_mkfile() needs the dir to exist */
if (!git_path_exists("./invalid/.GIT"))
cl_must_pass(p_mkdir("./invalid/.GIT", 0777));
if (!git_path_exists("./invalid/.GiT"))
cl_must_pass(p_mkdir("./invalid/.GiT", 0777));
add_invalid_filename(repo, ".git/hello");
add_invalid_filename(repo, ".GIT/hello");
add_invalid_filename(repo, ".GiT/hello");
add_invalid_filename(repo, "./.git/hello");
add_invalid_filename(repo, "./foo");
add_invalid_filename(repo, "./bar");
add_invalid_filename(repo, "subdir/../bar");
git_repository_free(repo);
cl_fixture_cleanup("invalid");
}
示例6: test_online_clone__credentials
void test_online_clone__credentials(void)
{
/* Remote URL environment variable must be set.
* User and password are optional.
*/
const char *remote_url = cl_getenv("GITTEST_REMOTE_URL");
git_cred_userpass_payload user_pass = {
cl_getenv("GITTEST_REMOTE_USER"),
cl_getenv("GITTEST_REMOTE_PASS")
};
if (!remote_url) return;
if (cl_getenv("GITTEST_REMOTE_DEFAULT")) {
g_options.remote_callbacks.credentials = cred_default;
} else {
g_options.remote_callbacks.credentials = git_cred_userpass;
g_options.remote_callbacks.payload = &user_pass;
}
cl_git_pass(git_clone(&g_repo, remote_url, "./foo", &g_options));
git_repository_free(g_repo);
g_repo = NULL;
cl_fixture_cleanup("./foo");
}
示例7: test_object_commit_commitstagedfile__cleanup
void test_object_commit_commitstagedfile__cleanup(void)
{
git_repository_free(repo);
repo = NULL;
cl_fixture_cleanup("treebuilder");
}
示例8: cleanup_fixture_submodules
static void cleanup_fixture_submodules(void *payload)
{
cl_git_sandbox_cleanup(); /* either "submodules" or "submod2" */
if (payload)
cl_fixture_cleanup(payload);
}
示例9: test_network_remotelocal__cleanup
void test_network_remotelocal__cleanup(void)
{
git_remote_free(remote);
git_buf_free(&file_path_buf);
git_repository_free(repo);
cl_fixture_cleanup("remotelocal");
}
示例10: test_refs_branches_create__cleanup
void test_refs_branches_create__cleanup(void)
{
git_object_free(target);
git_repository_free(repo);
cl_fixture_cleanup("testrepo.git");
}
示例11: cleanup_repository
static void cleanup_repository(void *path)
{
git_repository_free(_repo);
_repo = NULL;
cl_fixture_cleanup((const char *)path);
}
示例12: test_network_remote_local__push_to_non_bare_remote
void test_network_remote_local__push_to_non_bare_remote(void)
{
char *refspec_strings[] = {
"master:master",
};
git_strarray array = {
refspec_strings,
1,
};
/* Shouldn't be able to push to a non-bare remote */
git_remote *localremote;
git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT;
/* Get some commits */
connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_fetch(remote, &array, &fetch_opts, NULL));
/* Set up an empty non-bare repo to push into */
{
git_repository *remoterepo = NULL;
cl_git_pass(git_repository_init(&remoterepo, "localnonbare", 0));
git_repository_free(remoterepo);
}
/* Connect to the bare repo */
cl_git_pass(git_remote_create_anonymous(&localremote, repo, "./localnonbare"));
cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL, NULL, NULL));
/* Try to push */
cl_git_fail_with(GIT_EBAREREPO, git_remote_upload(localremote, &push_array, NULL));
/* Clean up */
git_remote_free(localremote);
cl_fixture_cleanup("localbare.git");
}
示例13: test_network_remote_local__push_to_bare_remote
void test_network_remote_local__push_to_bare_remote(void)
{
char *refspec_strings[] = {
"master:master",
};
git_strarray array = {
refspec_strings,
1,
};
/* Should be able to push to a bare remote */
git_remote *localremote;
/* Get some commits */
connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL));
/* Set up an empty bare repo to push into */
{
git_repository *localbarerepo;
cl_git_pass(git_repository_init(&localbarerepo, "./localbare.git", 1));
git_repository_free(localbarerepo);
}
/* Connect to the bare repo */
cl_git_pass(git_remote_create_anonymous(&localremote, repo, "./localbare.git"));
cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL, NULL, NULL));
/* Try to push */
cl_git_pass(git_remote_upload(localremote, &push_array, NULL));
/* Clean up */
git_remote_free(localremote);
cl_fixture_cleanup("localbare.git");
}
示例14: test_online_clone__clone_mirror
void test_online_clone__clone_mirror(void)
{
git_buf path = GIT_BUF_INIT;
git_remote *remote;
git_reference *head;
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
bool fetch_progress_cb_was_called = false;
cl_git_pass(git_repository_init(&g_repo, "./foo.git", true));
cl_git_pass(git_remote_create(&remote, g_repo, "origin", LIVE_REPO_URL));
callbacks.transfer_progress = &fetch_progress;
callbacks.payload = &fetch_progress_cb_was_called;
git_remote_set_callbacks(remote, &callbacks);
git_remote_clear_refspecs(remote);
cl_git_pass(git_remote_add_fetch(remote, "+refs/*:refs/*"));
cl_git_pass(git_clone_into(g_repo, remote, NULL, NULL, NULL));
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
cl_assert_equal_i(true, fetch_progress_cb_was_called);
git_remote_free(remote);
git_reference_free(head);
git_buf_free(&path);
git_repository_free(g_repo);
g_repo = NULL;
cl_fixture_cleanup("./foo.git");
}
示例15: test_refs_branches_delete__cleanup
void test_refs_branches_delete__cleanup(void)
{
git_reference_free(fake_remote);
git_repository_free(repo);
cl_fixture_cleanup("testrepo.git");
}