コード例 #1
0
ファイル: hard.c プロジェクト: jmendeth/node-gitteh
void test_reset_hard__cleanup(void)
{
	git_object_free(target);
	target = NULL;

	cl_git_sandbox_cleanup();
}
コード例 #2
0
ファイル: ignore.c プロジェクト: Angolier/sonic-pi
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);
	}
}
コード例 #3
0
ファイル: submodules.c プロジェクト: dmgctrl/libgit2
void test_diff_submodules__cleanup(void)
{
	cl_git_sandbox_cleanup();

	cl_fixture_cleanup("testrepo.git");
	cl_fixture_cleanup("submod2_target");
}
コード例 #4
0
ファイル: names.c プロジェクト: 1336/libgit2
void test_index_names__cleanup(void)
{
	git_index_free(repo_index);
	repo_index = NULL;

	cl_git_sandbox_cleanup();
}
コード例 #5
0
ファイル: describe.c プロジェクト: 1336/libgit2
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();
}
コード例 #6
0
ファイル: revparse.c プロジェクト: jmendeth/node-gitteh
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();
}
コード例 #7
0
ファイル: revparse.c プロジェクト: jmendeth/node-gitteh
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();
}
コード例 #8
0
ファイル: local.c プロジェクト: 1336/libgit2
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();
}
コード例 #9
0
static void cleanup_fixture_submodules(void *payload)
{
	cl_git_sandbox_cleanup(); /* either "submodules" or "submod2" */

	if (payload)
		cl_fixture_cleanup(payload);
}
コード例 #10
0
ファイル: open.c プロジェクト: 1336/libgit2
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);
}
コード例 #11
0
ファイル: create.c プロジェクト: YueLinHo/libgit2
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));
}
コード例 #12
0
ファイル: diff.c プロジェクト: ethomson/libgit2
void test_threads_diff__cleanup(void)
{
	cl_git_sandbox_cleanup();

#ifdef GIT_WIN32
	git_win32__retries = _retries;
#endif
}
コード例 #13
0
ファイル: index.c プロジェクト: benqian/repobuild
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);
}
コード例 #14
0
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");
}
コード例 #15
0
ファイル: delete.c プロジェクト: 1336/libgit2
void test_refs_branches_delete__cleanup(void)
{
	git_reference_free(fake_remote);
	fake_remote = NULL;

	cl_git_sandbox_cleanup();
	repo = NULL;
}
コード例 #16
0
ファイル: tree.c プロジェクト: Angeldude/sonic-pi
void test_diff_tree__cleanup(void)
{
	git_diff_free(diff);
	git_tree_free(a);
	git_tree_free(b);

	cl_git_sandbox_cleanup();

}
コード例 #17
0
ファイル: open.c プロジェクト: CodeSmithyIDE/libgit2
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;
}
コード例 #18
0
ファイル: default.c プロジェクト: 2020sebastian/libgit2
void test_reset_default__cleanup(void)
{
	git_object_free(_target);
	_target = NULL;

	git_index_free(_index);
	_index = NULL;

	cl_git_sandbox_cleanup();
}
コード例 #19
0
ファイル: tree.c プロジェクト: Kat7984/libgit2
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);
}
コード例 #20
0
ファイル: blob.c プロジェクト: RsrchBoy/p5-Git-Raw
void test_diff_blob__cleanup(void)
{
	git_blob_free(d);
	d = NULL;

	git_blob_free(alien);
	alien = NULL;

	cl_git_sandbox_cleanup();
}
コード例 #21
0
ファイル: empty.c プロジェクト: 0CV0/libgit2
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));
}
コード例 #22
0
ファイル: apply.c プロジェクト: Angeldude/sonic-pi
void test_stash_apply__cleanup(void)
{
	git_signature_free(signature);
	signature = NULL;

	git_index_free(repo_index);
	repo_index = NULL;

	cl_git_sandbox_cleanup();
}
コード例 #23
0
ファイル: create.c プロジェクト: Darthholi/WDX_GitCommander
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;
}
コード例 #24
0
ファイル: foreach.c プロジェクト: allidev/libgit2
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();
}
コード例 #25
0
ファイル: basic.c プロジェクト: Darthholi/WDX_GitCommander
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;
}
コード例 #26
0
ファイル: write.c プロジェクト: Angolier/sonic-pi
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();
}
コード例 #27
0
ファイル: env.c プロジェクト: Arhzi/libgit2
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();
}
コード例 #28
0
ファイル: reflog.c プロジェクト: csware/libgit2
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();
}
コード例 #29
0
ファイル: ishead.c プロジェクト: ralpheav/PM_GIT
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;
}
コード例 #30
0
ファイル: write.c プロジェクト: duralog/node-sencillo
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();
}