本文整理汇总了C++中cl_git_fail_with函数的典型用法代码示例。如果您正苦于以下问题:C++ cl_git_fail_with函数的具体用法?C++ cl_git_fail_with怎么用?C++ cl_git_fail_with使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cl_git_fail_with函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_transport_register__custom_transport_ssh
void test_transport_register__custom_transport_ssh(void)
{
git_transport *transport;
#ifndef GIT_SSH
cl_git_fail_with(git_transport_new(&transport, NULL, "ssh://somehost:somepath"), -1);
cl_git_fail_with(git_transport_new(&transport, NULL, "[email protected]:somepath"), -1);
#else
cl_git_pass(git_transport_new(&transport, NULL, "[email protected]:somepath"));
#endif
cl_git_pass(git_transport_register("ssh", dummy_transport, NULL));
cl_git_pass(git_transport_new(&transport, NULL, "[email protected]:somepath"));
cl_assert(transport == &_transport);
cl_git_pass(git_transport_unregister("ssh"));
#ifndef GIT_SSH
cl_git_fail_with(git_transport_new(&transport, NULL, "ssh://somehost:somepath"), -1);
cl_git_fail_with(git_transport_new(&transport, NULL, "[email protected]:somepath"), -1);
#else
cl_git_pass(git_transport_new(&transport, NULL, "[email protected]:somepath"));
#endif
}
开发者ID:KindDragon,项目名称:libgit2,代码行数:26,代码来源:register.c
示例2: test_diff_parse__nonpatches_fail_with_notfound
void test_diff_parse__nonpatches_fail_with_notfound(void)
{
git_diff *diff;
const char *not = PATCH_NOT_A_PATCH;
const char *not_with_leading = "Leading text.\n" PATCH_NOT_A_PATCH;
const char *not_with_trailing = PATCH_NOT_A_PATCH "Trailing text.\n";
const char *not_with_both = "Lead.\n" PATCH_NOT_A_PATCH "Trail.\n";
cl_git_fail_with(GIT_ENOTFOUND,
git_diff_from_buffer(&diff,
not,
strlen(not)));
cl_git_fail_with(GIT_ENOTFOUND,
git_diff_from_buffer(&diff,
not_with_leading,
strlen(not_with_leading)));
cl_git_fail_with(GIT_ENOTFOUND,
git_diff_from_buffer(&diff,
not_with_trailing,
strlen(not_with_trailing)));
cl_git_fail_with(GIT_ENOTFOUND,
git_diff_from_buffer(&diff,
not_with_both,
strlen(not_with_both)));
}
开发者ID:GuapoTaco,项目名称:chigraph,代码行数:25,代码来源:parse.c
示例3: test_stash_drop__cannot_drop_a_non_existing_stashed_state
void test_stash_drop__cannot_drop_a_non_existing_stashed_state(void)
{
push_three_states();
cl_git_fail_with(git_stash_drop(repo, 666), GIT_ENOTFOUND);
cl_git_fail_with(git_stash_drop(repo, 42), GIT_ENOTFOUND);
cl_git_fail_with(git_stash_drop(repo, 3), GIT_ENOTFOUND);
}
开发者ID:0CV0,项目名称:libgit2,代码行数:8,代码来源:drop.c
示例4: test_config_write__locking
void test_config_write__locking(void)
{
git_config *cfg, *cfg2;
git_config_entry *entry;
git_transaction *tx;
const char *filename = "locked-file";
/* Open the config and lock it */
cl_git_mkfile(filename, "[section]\n\tname = value\n");
cl_git_pass(git_config_open_ondisk(&cfg, filename));
cl_git_pass(git_config_get_entry(&entry, cfg, "section.name"));
cl_assert_equal_s("value", entry->value);
git_config_entry_free(entry);
cl_git_pass(git_config_lock(&tx, cfg));
/* Change entries in the locked backend */
cl_git_pass(git_config_set_string(cfg, "section.name", "other value"));
cl_git_pass(git_config_set_string(cfg, "section2.name3", "more value"));
/* We can see that the file we read from hasn't changed */
cl_git_pass(git_config_open_ondisk(&cfg2, filename));
cl_git_pass(git_config_get_entry(&entry, cfg2, "section.name"));
cl_assert_equal_s("value", entry->value);
git_config_entry_free(entry);
cl_git_fail_with(GIT_ENOTFOUND, git_config_get_entry(&entry, cfg2, "section2.name3"));
git_config_free(cfg2);
/* And we also get the old view when we read from the locked config */
cl_git_pass(git_config_get_entry(&entry, cfg, "section.name"));
cl_assert_equal_s("value", entry->value);
git_config_entry_free(entry);
cl_git_fail_with(GIT_ENOTFOUND, git_config_get_entry(&entry, cfg, "section2.name3"));
cl_git_pass(git_transaction_commit(tx));
git_transaction_free(tx);
/* Now that we've unlocked it, we should see both updates */
cl_git_pass(git_config_get_entry(&entry, cfg, "section.name"));
cl_assert_equal_s("other value", entry->value);
git_config_entry_free(entry);
cl_git_pass(git_config_get_entry(&entry, cfg, "section2.name3"));
cl_assert_equal_s("more value", entry->value);
git_config_entry_free(entry);
git_config_free(cfg);
/* We should also see the changes after reopening the config */
cl_git_pass(git_config_open_ondisk(&cfg, filename));
cl_git_pass(git_config_get_entry(&entry, cfg, "section.name"));
cl_assert_equal_s("other value", entry->value);
git_config_entry_free(entry);
cl_git_pass(git_config_get_entry(&entry, cfg, "section2.name3"));
cl_assert_equal_s("more value", entry->value);
git_config_entry_free(entry);
git_config_free(cfg);
}
开发者ID:Angolier,项目名称:sonic-pi,代码行数:57,代码来源:write.c
示例5: test_online_clone__certificate_invalid
void test_online_clone__certificate_invalid(void)
{
g_options.fetch_opts.callbacks.certificate_check = fail_certificate_check;
cl_git_fail_with(git_clone(&g_repo, "https://github.com/libgit2/TestGitRepository", "./foo", &g_options),
GIT_ECERTIFICATE);
#ifdef GIT_SSH
cl_git_fail_with(git_clone(&g_repo, "ssh://github.com/libgit2/TestGitRepository", "./foo", &g_options),
GIT_ECERTIFICATE);
#endif
}
开发者ID:RsrchBoy,项目名称:p5-Git-Raw,代码行数:12,代码来源:clone.c
示例6: assert_invalid_config_key_name
static void assert_invalid_config_key_name(const char *name)
{
cl_git_fail_with(git_config_get_string(&value, cfg, name),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_set_string(cfg, name, "42"),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_delete_entry(cfg, name),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_get_multivar_foreach(cfg, name, "*", NULL, NULL),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_set_multivar(cfg, name, "*", "42"),
GIT_EINVALIDSPEC);
}
开发者ID:DaneTheory,项目名称:libgit2,代码行数:13,代码来源:validkeyname.c
示例7: test_checkout_tree__can_cancel_checkout_from_notify
void test_checkout_tree__can_cancel_checkout_from_notify(void)
{
struct checkout_cancel_at ca;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
git_oid oid;
git_object *obj = NULL;
assert_on_branch(g_repo, "master");
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
ca.filename = "new.txt";
ca.error = -5555;
ca.count = 0;
opts.notify_flags = GIT_CHECKOUT_NOTIFY_UPDATED;
opts.notify_cb = checkout_cancel_cb;
opts.notify_payload = &ca;
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_assert(!git_path_exists("testrepo/new.txt"));
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), -5555);
cl_assert(!git_path_exists("testrepo/new.txt"));
/* on case-insensitive FS = a/b.txt, branch_file.txt, new.txt */
/* on case-sensitive FS = README, then above */
if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
cl_assert_equal_i(3, ca.count);
else
cl_assert_equal_i(4, ca.count);
/* and again with a different stopping point and return code */
ca.filename = "README";
ca.error = 123;
ca.count = 0;
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), 123);
cl_assert(!git_path_exists("testrepo/new.txt"));
if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
cl_assert_equal_i(4, ca.count);
else
cl_assert_equal_i(1, ca.count);
git_object_free(obj);
}
开发者ID:Kat7984,项目名称:libgit2,代码行数:51,代码来源:tree.c
示例8: test_stream_deprecated__register_tls
void test_stream_deprecated__register_tls(void)
{
git_stream *stream;
int error;
ctor_called = 0;
cl_git_pass(git_stream_register_tls(test_stream_init));
cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
cl_assert_equal_i(1, ctor_called);
cl_assert_equal_p(&test_stream, stream);
ctor_called = 0;
stream = NULL;
cl_git_pass(git_stream_register_tls(NULL));
error = git_tls_stream_new(&stream, "localhost", "443");
/*
* We don't have TLS support enabled, or we're on Windows,
* which has no arbitrary TLS stream support.
*/
#if defined(GIT_WIN32) || !defined(GIT_HTTPS)
cl_git_fail_with(-1, error);
#else
cl_git_pass(error);
#endif
cl_assert_equal_i(0, ctor_called);
cl_assert(&test_stream != stream);
git_stream_free(stream);
}
开发者ID:ethomson,项目名称:libgit2,代码行数:31,代码来源:deprecated.c
示例9: test_apply_both__application_failure_leaves_workdir_unmodified
void test_apply_both__application_failure_leaves_workdir_unmodified(void)
{
git_diff *diff;
git_index *index;
const char *diff_file = DIFF_MODIFY_TWO_FILES;
struct merge_index_entry workdir_expected[] = {
{ 0100644, "f51658077d85f2264fa179b4d0848268cb3475c3", 0, "asparagus.txt" },
{ 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" },
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
{ 0100644, "8684724651336001c5dbce74bed6736d2443958d", 0, "veal.txt" },
};
size_t workdir_expected_cnt = sizeof(workdir_expected) /
sizeof(struct merge_index_entry);
/* mutate the workdir */
cl_git_rewritefile("merge-recursive/veal.txt",
"This is a modification.\n");
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_add_bypath(index, "veal.txt"));
cl_git_pass(git_index_write(index));
git_index_free(index);
cl_git_pass(git_diff_from_buffer(&diff, diff_file, strlen(diff_file)));
cl_git_fail_with(GIT_EAPPLYFAIL, git_apply(repo, diff, GIT_APPLY_LOCATION_BOTH, NULL));
validate_apply_workdir(repo, workdir_expected, workdir_expected_cnt);
git_diff_free(diff);
}
开发者ID:CodeSmithyIDE,项目名称:libgit2,代码行数:34,代码来源:both.c
示例10: test_apply_both__index_must_match_workdir
void test_apply_both__index_must_match_workdir(void)
{
git_diff *diff;
git_index *index;
git_index_entry idx_entry;
const char *diff_file = DIFF_MODIFY_TWO_FILES;
/*
* Append a line to the end of the file in both the index and the
* working directory. Although the appended line would allow for
* patch application in each, the line appended is different in
* each, so the application should not be allowed.
*/
cl_git_append2file("merge-recursive/asparagus.txt",
"This is a modification.\n");
cl_git_pass(git_repository_index(&index, repo));
memset(&idx_entry, 0, sizeof(git_index_entry));
idx_entry.mode = 0100644;
idx_entry.path = "asparagus.txt";
cl_git_pass(git_oid_fromstr(&idx_entry.id, "06d3fefb8726ab1099acc76e02dfb85e034b2538"));
cl_git_pass(git_index_add(index, &idx_entry));
cl_git_pass(git_index_write(index));
git_index_free(index);
cl_git_pass(git_diff_from_buffer(&diff, diff_file, strlen(diff_file)));
cl_git_fail_with(GIT_EAPPLYFAIL, git_apply(repo, diff, GIT_APPLY_LOCATION_BOTH, NULL));
git_diff_free(diff);
}
开发者ID:CodeSmithyIDE,项目名称:libgit2,代码行数:33,代码来源:both.c
示例11: 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");
}
开发者ID:rlugojr,项目名称:libgit2,代码行数:35,代码来源:local.c
示例12: test_rebase_merge__custom_merge_options
void test_rebase_merge__custom_merge_options(void)
{
git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_annotated_commit *branch_head, *upstream_head;
git_rebase_options rebase_options = GIT_REBASE_OPTIONS_INIT;
git_rebase_operation *rebase_operation;
rebase_options.merge_options.flags |=
GIT_MERGE_FAIL_ON_CONFLICT |
GIT_MERGE_SKIP_REUC;
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/asparagus"));
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master"));
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_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_options));
cl_git_fail_with(GIT_EMERGECONFLICT, git_rebase_next(&rebase_operation, rebase));
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:J1978,项目名称:libgit2,代码行数:28,代码来源:merge.c
示例13: test_network_remote_remotes__error_when_no_push_available
void test_network_remote_remotes__error_when_no_push_available(void)
{
git_remote *r;
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
char *specs = {
"refs/heads/master",
};
git_strarray arr = {
&specs,
1,
};
cl_git_pass(git_remote_create_anonymous(&r, _repo, cl_fixture("testrepo.git")));
callbacks.transport = git_transport_local;
cl_git_pass(git_remote_connect(r, GIT_DIRECTION_PUSH, &callbacks, NULL));
/* Make sure that push is really not available */
r->transport->push = NULL;
cl_git_fail_with(-1, git_remote_upload(r, &arr, NULL));
git_remote_free(r);
}
开发者ID:Angolier,项目名称:sonic-pi,代码行数:25,代码来源:remotes.c
示例14: test_repo_init__symlinks_win32_enabled_by_global_config
void test_repo_init__symlinks_win32_enabled_by_global_config(void)
{
#ifndef GIT_WIN32
cl_skip();
#else
git_config *config, *repo_config;
int val;
if (!filesystem_supports_symlinks("link"))
cl_skip();
create_tmp_global_config("tmp_global_config", "core.symlinks", "true");
/*
* Create a new repository (can't use `assert_config_on_init` since we
* want to examine configuration levels with more granularity.)
*/
cl_git_pass(git_repository_init(&_repo, "config_entry/test.non.bare.git", false));
/* Ensure that core.symlinks remains set (via the global config). */
cl_git_pass(git_repository_config(&config, _repo));
cl_git_pass(git_config_get_bool(&val, config, "core.symlinks"));
cl_assert_equal_i(1, val);
/*
* Ensure that the repository config does not set core.symlinks.
* It should remain inherited.
*/
cl_git_pass(git_config_open_level(&repo_config, config, GIT_CONFIG_LEVEL_LOCAL));
cl_git_fail_with(GIT_ENOTFOUND, git_config_get_bool(&val, repo_config, "core.symlinks"));
git_config_free(repo_config);
git_config_free(config);
#endif
}
开发者ID:ethomson,项目名称:libgit2,代码行数:35,代码来源:init.c
示例15: test_core_stream__register_tls
void test_core_stream__register_tls(void)
{
git_stream *stream;
int error;
ctor_called = 0;
cl_git_pass(git_stream_register_tls(test_ctor));
cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
cl_assert_equal_i(1, ctor_called);
cl_assert_equal_p(&test_stream, stream);
ctor_called = 0;
stream = NULL;
cl_git_pass(git_stream_register_tls(NULL));
error = git_tls_stream_new(&stream, "localhost", "443");
/* We don't have arbitrary TLS stream support on Windows
* or when openssl support is disabled (except on OSX
* with Security framework).
*/
#if defined(GIT_WIN32) || \
(!defined(GIT_SECURE_TRANSPORT) && !defined(GIT_OPENSSL))
cl_git_fail_with(-1, error);
#else
cl_git_pass(error);
#endif
cl_assert_equal_i(0, ctor_called);
cl_assert(&test_stream != stream);
git_stream_free(stream);
}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:32,代码来源:stream.c
示例16: test_refs_branches_remote__no_matching_remote_returns_error
void test_refs_branches_remote__no_matching_remote_returns_error(void)
{
const char *unknown = "refs/remotes/nonexistent/master";
cl_git_fail_with(git_branch_remote_name(
NULL, 0, g_repo, unknown), GIT_ENOTFOUND);
}
开发者ID:2020sebastian,项目名称:libgit2,代码行数:7,代码来源:remote.c
示例17: test_rebase_merge__blocked_when_dirty
void test_rebase_merge__blocked_when_dirty(void)
{
git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_annotated_commit *branch_head, *upstream_head;
git_rebase_operation *rebase_operation;
git_oid commit_id;
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef"));
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master"));
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_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL));
/* Allow untracked files */
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_mkfile("rebase/untracked_file.txt", "This is untracked\n");
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
/* Do not allow unstaged */
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_mkfile("rebase/veal.txt", "This is an unstaged change\n");
cl_git_fail_with(GIT_EUNMERGED, git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
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:cthomas,项目名称:libgit2,代码行数:34,代码来源:merge.c
示例18: test_network_remote_defaultbranch__detached_sharing_nonbranch_id
void test_network_remote_defaultbranch__detached_sharing_nonbranch_id(void)
{
git_oid id, id_cloned;
git_reference *ref;
git_buf buf = GIT_BUF_INIT;
git_repository *cloned_repo;
cl_git_pass(git_reference_name_to_id(&id, g_repo_a, "HEAD"));
cl_git_pass(git_repository_detach_head(g_repo_a, NULL, NULL));
cl_git_pass(git_reference_remove(g_repo_a, "refs/heads/master"));
cl_git_pass(git_reference_remove(g_repo_a, "refs/heads/not-good"));
cl_git_pass(git_reference_create(&ref, g_repo_a, "refs/foo/bar", &id, 1, NULL, NULL));
git_reference_free(ref);
cl_git_pass(git_remote_connect(g_remote, GIT_DIRECTION_FETCH));
cl_git_fail_with(GIT_ENOTFOUND, git_remote_default_branch(&buf, g_remote));
cl_git_pass(git_clone(&cloned_repo, git_repository_path(g_repo_a), "./local-detached", NULL));
cl_assert(git_repository_head_detached(cloned_repo));
cl_git_pass(git_reference_name_to_id(&id_cloned, g_repo_a, "HEAD"));
cl_assert(git_oid_equal(&id, &id_cloned));
git_repository_free(cloned_repo);
}
开发者ID:Mikesalinas146,项目名称:libgit2,代码行数:25,代码来源:defaultbranch.c
示例19: test_refs_reflog_reflog__fails_gracefully_on_nonempty_reflog_dir
void test_refs_reflog_reflog__fails_gracefully_on_nonempty_reflog_dir(void)
{
git_reference *ref;
git_buf log_path = GIT_BUF_INIT;
git_oid id;
/* Create a new branch pointing at the HEAD */
git_oid_fromstr(&id, current_master_tip);
cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/new-dir/new-head", &id, 0, NULL));
git_reference_free(ref);
git_buf_joinpath(&log_path, git_repository_path(g_repo), GIT_REFLOG_DIR);
git_buf_joinpath(&log_path, git_buf_cstr(&log_path), "refs/heads/new-dir/new-head");
cl_assert_equal_i(true, git_path_isfile(git_buf_cstr(&log_path)));
/* delete the ref manually, leave the reflog */
cl_must_pass(p_unlink("testrepo.git/refs/heads/new-dir/new-head"));
/* new ref creation should fail since new-dir contains reflogs still */
git_oid_fromstr(&id, current_master_tip);
cl_git_fail_with(GIT_EDIRECTORY, git_reference_create(&ref, g_repo, "refs/heads/new-dir", &id, 0, NULL));
git_reference_free(ref);
git_buf_dispose(&log_path);
}
开发者ID:csware,项目名称:libgit2,代码行数:26,代码来源:reflog.c
示例20: test_network_remote_rename__overwrite_ref_in_target
void test_network_remote_rename__overwrite_ref_in_target(void)
{
git_oid id;
char idstr[GIT_OID_HEXSZ + 1] = {0};
git_reference *ref;
git_branch_t btype;
git_branch_iterator *iter;
git_strarray problems = {0};
cl_git_pass(git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
cl_git_pass(git_reference_create(&ref, _repo, "refs/remotes/renamed/master", &id, 1, NULL, NULL));
git_reference_free(ref);
cl_git_pass(git_remote_rename(&problems, _repo, _remote_name, "renamed"));
cl_assert_equal_i(0, problems.count);
git_strarray_free(&problems);
/* make sure there's only one remote-tracking branch */
cl_git_pass(git_branch_iterator_new(&iter, _repo, GIT_BRANCH_REMOTE));
cl_git_pass(git_branch_next(&ref, &btype, iter));
cl_assert_equal_s("refs/remotes/renamed/master", git_reference_name(ref));
git_oid_fmt(idstr, git_reference_target(ref));
cl_assert_equal_s("be3563ae3f795b2b4353bcce3a527ad0a4f7f644", idstr);
git_reference_free(ref);
cl_git_fail_with(GIT_ITEROVER, git_branch_next(&ref, &btype, iter));
git_branch_iterator_free(iter);
}
开发者ID:Darthholi,项目名称:WDX_GitCommander,代码行数:28,代码来源:rename.c
注:本文中的cl_git_fail_with函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论