void test_reset_hard__cleanup(void) { git_object_free(target); target = NULL; cl_git_sandbox_cleanup(); }
void test_status_ignore__filenames_with_special_prefixes_do_not_interfere_with_status_retrieval(void) { status_entry_single st; char *test_cases[] = { "!file", "#blah", "[blah]", "[attr]", "[attr]blah", NULL }; int i; for (i = 0; *(test_cases + i) != NULL; i++) { git_buf file = GIT_BUF_INIT; char *file_name = *(test_cases + i); git_repository *repo = cl_git_sandbox_init("empty_standard_repo"); cl_git_pass(git_buf_joinpath(&file, "empty_standard_repo", file_name)); cl_git_mkfile(git_buf_cstr(&file), "Please don't ignore me!"); memset(&st, 0, sizeof(st)); cl_git_pass(git_status_foreach(repo, cb_status__single, &st)); cl_assert(st.count == 1); cl_assert(st.status == GIT_STATUS_WT_NEW); cl_git_pass(git_status_file(&st.status, repo, file_name)); cl_assert(st.status == GIT_STATUS_WT_NEW); cl_git_sandbox_cleanup(); git_buf_free(&file); } }
void test_diff_submodules__cleanup(void) { cl_git_sandbox_cleanup(); cl_fixture_cleanup("testrepo.git"); cl_fixture_cleanup("submod2_target"); }
void test_index_names__cleanup(void) { git_index_free(repo_index); repo_index = NULL; cl_git_sandbox_cleanup(); }
void test_describe_describe__describe_a_repo_with_no_refs(void) { git_repository *repo; git_describe_options opts = GIT_DESCRIBE_OPTIONS_INIT; git_buf buf = GIT_BUF_INIT; git_object *object; git_describe_result *result = NULL; repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_revparse_single(&object, repo, "HEAD")); cl_git_pass(git_reference_foreach(repo, delete_cb, NULL)); /* Impossible to describe without falling back to OIDs */ cl_git_fail(git_describe_commit(&result, object, &opts)); /* Try again with OID fallbacks */ opts.show_commit_oid_as_fallback = 1; cl_git_pass(git_describe_commit(&result, object, &opts)); git_describe_result_free(result); git_object_free(object); git_buf_free(&buf); cl_git_sandbox_cleanup(); }
void test_refs_revparse__reflog_of_a_ref_under_refs(void) { git_repository *repo = cl_git_sandbox_init("testrepo.git"); test_object_inrepo("refs/fakestash", NULL, repo); create_fake_stash_reference_and_reflog(repo); /* * $ git reflog -1 refs/fakestash * a65fedf refs/fakestash@{0}: commit: checking in * * $ git reflog -1 refs/fakestash@{0} * a65fedf refs/fakestash@{0}: commit: checking in * * $ git reflog -1 fakestash * a65fedf fakestash@{0}: commit: checking in * * $ git reflog -1 fakestash@{0} * a65fedf fakestash@{0}: commit: checking in */ test_object_inrepo("refs/fakestash", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo); test_object_inrepo("refs/fakestash@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo); test_object_inrepo("fakestash", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo); test_object_inrepo("fakestash@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo); cl_git_sandbox_cleanup(); }
void test_refs_revparse__issue_994(void) { git_repository *repo; git_reference *head, *with_at; git_object *target; repo = cl_git_sandbox_init("testrepo.git"); cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&target, repo, "origin/bim_with_3d@11296")); cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&target, repo, "refs/remotes/origin/bim_with_3d@11296")); cl_git_pass(git_repository_head(&head, repo)); cl_git_pass(git_reference_create( &with_at, repo, "refs/remotes/origin/bim_with_3d@11296", git_reference_target(head), 0)); cl_git_pass(git_revparse_single(&target, repo, "origin/bim_with_3d@11296")); git_object_free(target); cl_git_pass(git_revparse_single(&target, repo, "refs/remotes/origin/bim_with_3d@11296")); git_object_free(target); git_reference_free(with_at); git_reference_free(head); cl_git_sandbox_cleanup(); }
void test_network_remote_local__push_delete(void) { git_repository *src_repo; git_repository *dst_repo; git_remote *remote; git_reference *ref; char *spec_push[] = { "refs/heads/master" }; char *spec_delete[] = { ":refs/heads/master" }; git_strarray specs = { spec_push, 1, }; src_repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_init(&dst_repo, "target.git", 1)); cl_git_pass(git_remote_create(&remote, src_repo, "origin", "./target.git")); /* Push the master branch and verify it's there */ cl_git_pass(git_remote_push(remote, &specs, NULL)); cl_git_pass(git_reference_lookup(&ref, dst_repo, "refs/heads/master")); git_reference_free(ref); specs.strings = spec_delete; cl_git_pass(git_remote_push(remote, &specs, NULL)); cl_git_fail(git_reference_lookup(&ref, dst_repo, "refs/heads/master")); git_remote_free(remote); git_repository_free(dst_repo); cl_fixture_cleanup("target.git"); cl_git_sandbox_cleanup(); }
static void cleanup_fixture_submodules(void *payload) { cl_git_sandbox_cleanup(); /* either "submodules" or "submod2" */ if (payload) cl_fixture_cleanup(payload); }
void test_repo_open__cleanup(void) { cl_git_sandbox_cleanup(); if (git_path_isdir("alternate")) git_futils_rmdir_r("alternate", NULL, GIT_RMDIR_REMOVE_FILES); }
void test_refs_create__cleanup(void) { cl_git_sandbox_cleanup(); cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 1)); cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION, 1)); cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 0)); }
void test_threads_diff__cleanup(void) { cl_git_sandbox_cleanup(); #ifdef GIT_WIN32 git_win32__retries = _retries; #endif }
void test_checkout_index__cleanup(void) { cl_git_sandbox_cleanup(); /* try to remove alternative dir */ if (git_path_isdir("alternative")) git_futils_rmdir_r("alternative", NULL, GIT_RMDIR_REMOVE_FILES); }
void test_network_remote_defaultbranch__cleanup(void) { git_remote_free(g_remote); git_repository_free(g_repo_b); cl_git_sandbox_cleanup(); cl_fixture_cleanup("repo-b.git"); }
void test_refs_branches_delete__cleanup(void) { git_reference_free(fake_remote); fake_remote = NULL; cl_git_sandbox_cleanup(); repo = NULL; }
void test_diff_tree__cleanup(void) { git_diff_free(diff); git_tree_free(a); git_tree_free(b); cl_git_sandbox_cleanup(); }
void test_submodule_open__cleanup(void) { git_submodule_free(g_module); git_repository_free(g_child); cl_git_sandbox_cleanup(); g_parent = NULL; g_child = NULL; g_module = NULL; }
void test_reset_default__cleanup(void) { git_object_free(_target); _target = NULL; git_index_free(_index); _index = NULL; cl_git_sandbox_cleanup(); }
void test_checkout_tree__cleanup(void) { git_object_free(g_object); g_object = NULL; cl_git_sandbox_cleanup(); if (git_path_isdir("alternative")) git_futils_rmdir_r("alternative", NULL, GIT_RMDIR_REMOVE_FILES); }
void test_diff_blob__cleanup(void) { git_blob_free(d); d = NULL; git_blob_free(alien); alien = NULL; cl_git_sandbox_cleanup(); }
void test_clone_empty__can_clone_an_empty_standard_repo(void) { cl_git_sandbox_cleanup(); g_repo = cl_git_sandbox_init("empty_standard_repo"); cl_git_remove_placeholders(git_repository_path(g_repo), "dummy-marker.txt"); cl_set_cleanup(&cleanup_repository, "./empty"); cl_git_pass(git_clone(&g_repo_cloned, "./empty_standard_repo", "./empty", &g_options)); }
void test_stash_apply__cleanup(void) { git_signature_free(signature); signature = NULL; git_index_free(repo_index); repo_index = NULL; cl_git_sandbox_cleanup(); }
void test_refs_branches_create__cleanup(void) { git_reference_free(branch); branch = NULL; git_commit_free(target); target = NULL; cl_git_sandbox_cleanup(); repo = NULL; }
void test_refs_branches_foreach__cleanup(void) { git_reference_free(fake_remote); fake_remote = NULL; git_repository_free(repo); repo = NULL; cl_fixture_cleanup("testrepo.git"); cl_git_sandbox_cleanup(); }
void test_revwalk_basic__cleanup(void) { git_revwalk_free(_walk); if (_fixture) cl_git_sandbox_cleanup(); else git_repository_free(_repo); _fixture = NULL; _repo = NULL; _walk = NULL; }
void test_config_write__can_set_a_value_to_NULL(void) { git_repository *repository; git_config *config; repository = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_config(&config, repository)); cl_git_fail(git_config_set_string(config, "a.b.c", NULL)); git_config_free(config); cl_git_sandbox_cleanup(); }
void test_repo_env__cleanup(void) { cl_git_sandbox_cleanup(); if (git_path_isdir("attr")) git_futils_rmdir_r("attr", NULL, GIT_RMDIR_REMOVE_FILES); if (git_path_isdir("testrepo.git")) git_futils_rmdir_r("testrepo.git", NULL, GIT_RMDIR_REMOVE_FILES); if (git_path_isdir("peeled.git")) git_futils_rmdir_r("peeled.git", NULL, GIT_RMDIR_REMOVE_FILES); clear_git_env(); }
void test_refs_reflog_reflog__logallrefupdates_nonbare_set_false(void) { git_config *config; cl_git_sandbox_cleanup(); g_repo = cl_git_sandbox_init("testrepo"); cl_git_pass(git_repository_config(&config, g_repo)); cl_git_pass(git_config_set_bool(config, "core.logallrefupdates", false)); git_config_free(config); assert_no_reflog_update(); }
void test_refs_branches_ishead__can_properly_handle_orphaned_HEAD(void) { git_repository_free(repo); repo = cl_git_sandbox_init("testrepo.git"); make_head_orphaned(repo, NON_EXISTING_HEAD); cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); cl_assert_equal_i(false, git_branch_is_head(branch)); cl_git_sandbox_cleanup(); repo = NULL; }
void test_commit_write__cleanup(void) { git_reference_free(head); head = NULL; git_reference_free(branch); branch = NULL; git_commit_free(commit); commit = NULL; git__free(head_old); head_old = NULL; cl_git_sandbox_cleanup(); }