• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cl_git_fail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cl_git_fail函数的典型用法代码示例。如果您正苦于以下问题:C++ cl_git_fail函数的具体用法?C++ cl_git_fail怎么用?C++ cl_git_fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cl_git_fail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_submodule_status__ignore_untracked

void test_submodule_status__ignore_untracked(void)
{
	unsigned int status;
	git_submodule *sm;
	git_buf path = GIT_BUF_INIT;
	git_submodule_ignore_t ign = GIT_SUBMODULE_IGNORE_UNTRACKED;

	cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(g_repo), "sm_unchanged"));
	cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), NULL, GIT_RMDIR_REMOVE_FILES));

	cl_git_pass(git_submodule_foreach(g_repo, set_sm_ignore, &ign));

	cl_git_fail(git_submodule_lookup(&sm, g_repo, "not_submodule"));

	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_changed_index"));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED) != 0);

	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_changed_head"));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_WD_MODIFIED) != 0);

	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_changed_file"));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_WD_WD_MODIFIED) != 0);

	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_changed_untracked_file"));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));

	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_missing_commits"));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_WD_MODIFIED) != 0);

	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_added_and_uncommited"));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_INDEX_ADDED) != 0);

	/* removed sm_unchanged for deleted workdir */
	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_unchanged"));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_WD_DELETED) != 0);

	/* now mkdir sm_unchanged to test uninitialized */
	cl_git_pass(git_futils_mkdir(git_buf_cstr(&path), NULL, 0755, 0));
	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_unchanged"));
	cl_git_pass(git_submodule_reload(sm));
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_WD_UNINITIALIZED) != 0);

	/* update sm_changed_head in index */
	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_changed_head"));
	cl_git_pass(git_submodule_add_to_index(sm, true));
	/* reload is not needed because add_to_index updates the submodule data */
	cl_git_pass(git_submodule_status(&status, sm));
	cl_assert((status & GIT_SUBMODULE_STATUS_INDEX_MODIFIED) != 0);

	git_buf_free(&path);
}
开发者ID:duralog,项目名称:node-sencillo,代码行数:59,代码来源:status.c


示例2: assert_non_exisitng_branch_removal

static void assert_non_exisitng_branch_removal(const char *branch_name, git_branch_t branch_type)
{
	int error; 
	error = git_branch_delete(repo, branch_name, branch_type);

	cl_git_fail(error);
	cl_assert_equal_i(GIT_ENOTFOUND, error);
}
开发者ID:Asquera,项目名称:libgit2,代码行数:8,代码来源:delete.c


示例3: test_merge_workdir_dirty__affected_dirty_files_disallowed

void test_merge_workdir_dirty__affected_dirty_files_disallowed(void)
{
	char **files;
	size_t i;

	for (i = 0, files = affected[i]; files[0]; files = affected[++i])
		cl_git_fail(merge_dirty_files(files));
}
开发者ID:1336,项目名称:libgit2,代码行数:8,代码来源:dirty.c


示例4: test_refs_revparse__to_type

void test_refs_revparse__to_type(void)
{
	test_object("wrapped_tag^{commit}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("wrapped_tag^{tree}", "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
	test_object("point_to_blob^{blob}", "1385f264afb75a56a5bec74243be9b367ba4ca08");

	cl_git_fail(git_revparse_single(&g_obj, g_repo, "wrapped_tag^{blob}"));
}
开发者ID:ileitch,项目名称:meanie,代码行数:8,代码来源:revparse.c


示例5: test_index_crlf__safecrlf_true_no_attrs

void test_index_crlf__safecrlf_true_no_attrs(void)
{
	cl_repo_set_bool(g_repo, "core.autocrlf", true);
	cl_repo_set_bool(g_repo, "core.safecrlf", true);

	cl_git_mkfile("crlf/newfile.txt", ALL_LF_TEXT_RAW);
	cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));

	cl_git_mkfile("crlf/newfile.txt", ALL_CRLF_TEXT_RAW);
	cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));

	cl_git_mkfile("crlf/newfile.txt", MORE_CRLF_TEXT_RAW);
	cl_git_fail(git_index_add_bypath(g_index, "newfile.txt"));

	cl_git_mkfile("crlf/newfile.txt", MORE_LF_TEXT_RAW);
	cl_git_fail(git_index_add_bypath(g_index, "newfile.txt"));
}
开发者ID:DonkeyWs,项目名称:libgit2,代码行数:17,代码来源:crlf.c


示例6: test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory

void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(void)
{
	cl_set_cleanup(&cleanup_repository, "./foo");

	p_mkdir("./foo", GIT_DIR_MODE);
	cl_git_mkfile("./foo/bar", "Baz!");
	cl_git_fail(git_clone(&g_repo, LIVE_REPO_URL, "./foo", NULL, NULL, NULL));
}
开发者ID:spritetong,项目名称:tortoisegit-libgit2-utf8,代码行数:8,代码来源:nonetwork.c


示例7: test_checkout_index__cannot_checkout_a_bare_repository

void test_checkout_index__cannot_checkout_a_bare_repository(void)
{
	test_checkout_index__cleanup();

	g_repo = cl_git_sandbox_init("testrepo.git");

	cl_git_fail(git_checkout_index(g_repo, NULL, NULL));
}
开发者ID:duralog,项目名称:node-sencillo,代码行数:8,代码来源:index.c


示例8: test_notes_notes__creating_a_note_on_a_target_which_already_has_one_returns_EEXISTS

/*
 * $ git notes --ref fanout list 8496071c1b46c854b31185ea97743be6a8774479
 * 08b041783f40edfe12bb406c9c9a8a040177c125
 */
void test_notes_notes__creating_a_note_on_a_target_which_already_has_one_returns_EEXISTS(void)
{
	int error;
	git_oid note_oid, target_oid;

	cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));

	create_note(&note_oid, NULL, "08b041783f40edfe12bb406c9c9a8a040177c125", "hello world\n");
	error = git_note_create(&note_oid, _repo, NULL, _sig, _sig, &target_oid, "hello world\n", 0);
	cl_git_fail(error);
	cl_assert_equal_i(GIT_EEXISTS, error);

	create_note(&note_oid, "refs/notes/some/namespace", "08b041783f40edfe12bb406c9c9a8a040177c125", "hello world\n");
	error = git_note_create(&note_oid, _repo, "refs/notes/some/namespace", _sig, _sig, &target_oid, "hello world\n", 0);
	cl_git_fail(error);
	cl_assert_equal_i(GIT_EEXISTS, error);
}
开发者ID:Darthholi,项目名称:WDX_GitCommander,代码行数:21,代码来源:notes.c


示例9: test_copy_note

static void test_copy_note(
	const git_rebase_options *opts,
	bool should_exist)
{
	git_rebase *rebase;
	git_reference *branch_ref, *upstream_ref;
	git_annotated_commit *branch_head, *upstream_head;
	git_commit *branch_commit;
	git_rebase_operation *rebase_operation;
	git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
	git_oid note_id, commit_id;
	git_note *note = NULL;
	int error;

	checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;

	cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/gravy"));
	cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));

	cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
	cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));

	cl_git_pass(git_reference_peel((git_object **)&branch_commit,
		branch_ref, GIT_OBJ_COMMIT));

	/* Add a note to a commit */
	cl_git_pass(git_note_create(&note_id, repo, "refs/notes/test",
		git_commit_author(branch_commit), git_commit_committer(branch_commit),
		git_commit_id(branch_commit),
		"This is a commit note.", 0));

	cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, opts));

	cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
	cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
		NULL, NULL));

	cl_git_pass(git_rebase_finish(rebase, signature, opts));

	cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));

	if (should_exist) {
		cl_git_pass(git_note_read(&note, repo, "refs/notes/test", &commit_id));
		cl_assert_equal_s("This is a commit note.", git_note_message(note));
	} else {
		cl_git_fail(error =
			git_note_read(&note, repo, "refs/notes/test", &commit_id));
		cl_assert_equal_i(GIT_ENOTFOUND, error);
	}

	git_note_free(note);
	git_commit_free(branch_commit);
	git_annotated_commit_free(branch_head);
	git_annotated_commit_free(upstream_head);
	git_reference_free(branch_ref);
	git_reference_free(upstream_ref);
	git_rebase_free(rebase);
}
开发者ID:CODECOMMUNITY,项目名称:p5-Git-Raw,代码行数:58,代码来源:merge.c


示例10: test_diff_tree__larger_hunks

void test_diff_tree__larger_hunks(void)
{
	const char *a_commit = "d70d245ed97ed2aa596dd1af6536e4bfdb047b69";
	const char *b_commit = "7a9e0b02e63179929fed24f0a3e0f19168114d10";
	size_t d, num_d, h, num_h, l, num_l;
	git_patch *patch;
	const git_diff_hunk *hunk;
	const git_diff_line *line;

	g_repo = cl_git_sandbox_init("diff");

	cl_assert((a = resolve_commit_oid_to_tree(g_repo, a_commit)) != NULL);
	cl_assert((b = resolve_commit_oid_to_tree(g_repo, b_commit)) != NULL);

	opts.context_lines = 1;
	opts.interhunk_lines = 0;

	cl_git_pass(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts));

	num_d = git_diff_num_deltas(diff);
	for (d = 0; d < num_d; ++d) {
		cl_git_pass(git_patch_from_diff(&patch, diff, d));
		cl_assert(patch);

		num_h = git_patch_num_hunks(patch);
		for (h = 0; h < num_h; h++) {
			cl_git_pass(git_patch_get_hunk(&hunk, &num_l, patch, h));

			for (l = 0; l < num_l; ++l) {
				cl_git_pass(git_patch_get_line_in_hunk(&line, patch, h, l));
				cl_assert(line);
			}

			cl_git_fail(git_patch_get_line_in_hunk(&line, patch, h, num_l));
		}

		cl_git_fail(git_patch_get_hunk(&hunk, &num_l, patch, num_h));

		git_patch_free(patch);
	}

	cl_git_fail(git_patch_from_diff(&patch, diff, num_d));

	cl_assert_equal_i(2, (int)num_d);
}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:45,代码来源:tree.c


示例11: test_checkout_index__validates_struct_version

void test_checkout_index__validates_struct_version(void)
{
	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
	const git_error *err;

	opts.version = 1024;
	cl_git_fail(git_checkout_index(g_repo, NULL, &opts));

	err = giterr_last();
	cl_assert_equal_i(err->klass, GITERR_INVALID);

	opts.version = 0;
	giterr_clear();
	cl_git_fail(git_checkout_index(g_repo, NULL, &opts));

	err = giterr_last();
	cl_assert_equal_i(err->klass, GITERR_INVALID);
}
开发者ID:duralog,项目名称:node-sencillo,代码行数:18,代码来源:index.c


示例12: test_commit_parse__details0

// query the details on a parsed commit
void test_commit_parse__details0(void) {
   static const char *commit_ids[] = {
      "a4a7dce85cf63874e984719f4fdd239f5145052f", /* 0 */
      "9fd738e8f7967c078dceed8190330fc8648ee56a", /* 1 */
      "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", /* 2 */
      "c47800c7266a2be04c571c04d5a6614691ea99bd", /* 3 */
      "8496071c1b46c854b31185ea97743be6a8774479", /* 4 */
      "5b5b025afb0b4c913b4c338a42934a3863bf3644", /* 5 */
      "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", /* 6 */
   };
	const size_t commit_count = sizeof(commit_ids) / sizeof(const char *);
   unsigned int i;

	for (i = 0; i < commit_count; ++i) {
		git_oid id;
		git_commit *commit;

		const git_signature *author, *committer;
		const char *message;
		git_time_t commit_time;
		unsigned int parents, p;
		git_commit *parent = NULL, *old_parent = NULL;

		git_oid_fromstr(&id, commit_ids[i]);

		cl_git_pass(git_commit_lookup(&commit, g_repo, &id));

		message = git_commit_message(commit);
		author = git_commit_author(commit);
		committer = git_commit_committer(commit);
		commit_time = git_commit_time(commit);
		parents = git_commit_parentcount(commit);

		cl_assert_equal_s("Scott Chacon", author->name);
		cl_assert_equal_s("[email protected]", author->email);
		cl_assert_equal_s("Scott Chacon", committer->name);
		cl_assert_equal_s("[email protected]", committer->email);
		cl_assert(message != NULL);
		cl_assert(strchr(message, '\n') != NULL);
		cl_assert(commit_time > 0);
		cl_assert(parents <= 2);
		for (p = 0;p < parents;p++) {
			if (old_parent != NULL)
				git_commit_free(old_parent);

			old_parent = parent;
			cl_git_pass(git_commit_parent(&parent, commit, p));
			cl_assert(parent != NULL);
			cl_assert(git_commit_author(parent) != NULL); // is it really a commit?
		}
		git_commit_free(old_parent);
		git_commit_free(parent);

		cl_git_fail(git_commit_parent(&parent, commit, parents));
		git_commit_free(commit);
	}
}
开发者ID:duralog,项目名称:node-sencillo,代码行数:58,代码来源:parse.c


示例13: test_refs_branches_delete__can_not_delete_a_branch_if_HEAD_is_missing

void test_refs_branches_delete__can_not_delete_a_branch_if_HEAD_is_missing(void)
{
	git_reference *head;

	cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
	git_reference_delete(head);

	cl_git_fail(git_branch_delete(repo, "br2", GIT_BRANCH_LOCAL));
}
开发者ID:Asquera,项目名称:libgit2,代码行数:9,代码来源:delete.c


示例14: test_network_cred__stock_userpass_validates_that_method_is_allowed

void test_network_cred__stock_userpass_validates_that_method_is_allowed(void)
{
	git_cred *cred;
	git_cred_userpass_payload payload = {"user", "pass"};

	cl_git_fail(git_cred_userpass(&cred, NULL, NULL, 0, &payload));
	cl_git_pass(git_cred_userpass(&cred, NULL, NULL, GIT_CREDTYPE_USERPASS_PLAINTEXT, &payload));
	cred->free(cred);
}
开发者ID:0CV0,项目名称:libgit2,代码行数:9,代码来源:cred.c


示例15: expect_unquote_fail

static void expect_unquote_fail(const char *quoted)
{
	git_buf buf = GIT_BUF_INIT;

	cl_git_pass(git_buf_puts(&buf, quoted));
	cl_git_fail(git_buf_unquote(&buf));

	git_buf_dispose(&buf);
}
开发者ID:CodeSmithyIDE,项目名称:libgit2,代码行数:9,代码来源:quote.c


示例16: test_network_remote_rename__cannot_rename_an_inmemory_remote

void test_network_remote_rename__cannot_rename_an_inmemory_remote(void)
{
	git_remote *remote;

	cl_git_pass(git_remote_create_inmemory(&remote, _repo, NULL, "file:///blah"));
	cl_git_fail(git_remote_rename(remote, "newname", NULL, NULL));

	git_remote_free(remote);
}
开发者ID:0CV0,项目名称:libgit2,代码行数:9,代码来源:rename.c


示例17: test_refs_revparse__reflog

void test_refs_revparse__reflog(void)
{
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-xyz}"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-0}"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{1000}"));

	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "[email protected]{0}"));
	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "[email protected]{31415}"));

	test_object("@{-2}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("@{-1}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
	test_object("[email protected]{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("[email protected]{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("[email protected]{upstream}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("[email protected]{u}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
}
开发者ID:ileitch,项目名称:meanie,代码行数:18,代码来源:revparse.c


示例18: test_win32_longpath__errmsg_on_checkout

void test_win32_longpath__errmsg_on_checkout(void)
{
#ifdef GIT_WIN32
	git_repository *repo;

	cl_git_fail(git_clone(&repo, cl_fixture("testrepo.git"), path.ptr, NULL));
	assert_name_too_long();
#endif
}
开发者ID:KTXSoftware,项目名称:libgit2,代码行数:9,代码来源:longpath.c


示例19: test_online_clone__ssh_cannot_change_username

void test_online_clone__ssh_cannot_change_username(void)
{
#ifndef GIT_SSH
	clar__skip();
#endif
	g_options.fetch_opts.callbacks.credentials = cred_foo_bar;

	cl_git_fail(git_clone(&g_repo, "ssh://[email protected]/libgit2/TestGitRepository", "./foo", &g_options));
}
开发者ID:RsrchBoy,项目名称:p5-Git-Raw,代码行数:9,代码来源:clone.c


示例20: test_refs_normalize__buffer_has_to_be_big_enough_to_hold_the_normalized_version

void test_refs_normalize__buffer_has_to_be_big_enough_to_hold_the_normalized_version(void)
{
	char buffer_out[21];

	cl_git_pass(git_reference_normalize_name(
		buffer_out, 21, "refs//heads///long///name", GIT_REF_FORMAT_NORMAL));
	cl_git_fail(git_reference_normalize_name(
		buffer_out, 20, "refs//heads///long///name", GIT_REF_FORMAT_NORMAL));
}
开发者ID:jmendeth,项目名称:node-gitteh,代码行数:9,代码来源:normalize.c



注:本文中的cl_git_fail函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cl_git_fail_with函数代码示例发布时间:2022-05-30
下一篇:
C++ cl_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap