diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-01-07 12:23:05 +0000 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-03 14:40:50 +0100 |
| commit | 659cf2029f322ea876d663d85783b48945227e8f (patch) | |
| tree | 435e9185c38d96656e21db83fc736b5294499b10 /tests/network/remote | |
| parent | 99b68a2aecfaa24f252f265d61b230b8e2576dd2 (diff) | |
| download | libgit2-659cf2029f322ea876d663d85783b48945227e8f.tar.gz | |
Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.
In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
Diffstat (limited to 'tests/network/remote')
| -rw-r--r-- | tests/network/remote/defaultbranch.c | 10 | ||||
| -rw-r--r-- | tests/network/remote/local.c | 41 | ||||
| -rw-r--r-- | tests/network/remote/remotes.c | 4 | ||||
| -rw-r--r-- | tests/network/remote/rename.c | 4 |
4 files changed, 24 insertions, 35 deletions
diff --git a/tests/network/remote/defaultbranch.c b/tests/network/remote/defaultbranch.c index 243369fa2..293a860d9 100644 --- a/tests/network/remote/defaultbranch.c +++ b/tests/network/remote/defaultbranch.c @@ -39,13 +39,13 @@ void test_network_remote_defaultbranch__master(void) void test_network_remote_defaultbranch__master_does_not_win(void) { - cl_git_pass(git_repository_set_head(g_repo_a, "refs/heads/not-good", NULL, NULL)); + cl_git_pass(git_repository_set_head(g_repo_a, "refs/heads/not-good", NULL)); assert_default_branch("refs/heads/not-good"); } void test_network_remote_defaultbranch__master_on_detached(void) { - cl_git_pass(git_repository_detach_head(g_repo_a, NULL, NULL)); + cl_git_pass(git_repository_detach_head(g_repo_a, NULL)); assert_default_branch("refs/heads/master"); } @@ -74,10 +74,10 @@ void test_network_remote_defaultbranch__detached_sharing_nonbranch_id(void) 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_repository_detach_head(g_repo_a, 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)); + cl_git_pass(git_reference_create(&ref, g_repo_a, "refs/foo/bar", &id, 1, NULL)); git_reference_free(ref); cl_git_pass(git_remote_connect(g_remote, GIT_DIRECTION_FETCH)); @@ -97,7 +97,7 @@ void test_network_remote_defaultbranch__unborn_HEAD_with_branches(void) git_reference *ref; git_repository *cloned_repo; - cl_git_pass(git_reference_symbolic_create(&ref, g_repo_a, "HEAD", "refs/heads/i-dont-exist", 1, NULL, NULL)); + cl_git_pass(git_reference_symbolic_create(&ref, g_repo_a, "HEAD", "refs/heads/i-dont-exist", 1, NULL)); git_reference_free(ref); cl_git_pass(git_clone(&cloned_repo, git_repository_path(g_repo_a), "./semi-empty", NULL)); diff --git a/tests/network/remote/local.c b/tests/network/remote/local.c index 55453061b..54536e4e1 100644 --- a/tests/network/remote/local.c +++ b/tests/network/remote/local.c @@ -18,6 +18,7 @@ static git_strarray push_array = { void test_network_remote_local__initialize(void) { cl_git_pass(git_repository_init(&repo, "remotelocal/", 0)); + cl_git_pass(git_repository_set_ident(repo, "Foo Bar", "foo@example.com")); cl_assert(repo != NULL); } @@ -138,7 +139,7 @@ void test_network_remote_local__shorthand_fetch_refspec0(void) connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_download(remote, &array)); - cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); + cl_git_pass(git_remote_update_tips(remote, NULL)); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); git_reference_free(ref); @@ -164,7 +165,7 @@ void test_network_remote_local__shorthand_fetch_refspec1(void) git_remote_clear_refspecs(remote); cl_git_pass(git_remote_download(remote, &array)); - cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); + cl_git_pass(git_remote_update_tips(remote, NULL)); cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); @@ -177,7 +178,7 @@ void test_network_remote_local__tagopt(void) cl_git_pass(git_remote_create(&remote, repo, "tagopt", cl_git_path_url(cl_fixture("testrepo.git")))); git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_ALL); - cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL)); + cl_git_pass(git_remote_fetch(remote, NULL, NULL)); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master")); git_reference_free(ref); @@ -185,7 +186,7 @@ void test_network_remote_local__tagopt(void) git_reference_free(ref); git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_AUTO); - cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL)); + cl_git_pass(git_remote_fetch(remote, NULL, NULL)); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master")); git_reference_free(ref); } @@ -206,7 +207,7 @@ void test_network_remote_local__push_to_bare_remote(void) /* Get some commits */ connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_download(remote, &array)); - cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); + cl_git_pass(git_remote_update_tips(remote, NULL)); git_remote_disconnect(remote); /* Set up an empty bare repo to push into */ @@ -244,7 +245,7 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void) /* Get some commits */ connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_download(remote, &array)); - cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); + cl_git_pass(git_remote_update_tips(remote, NULL)); git_remote_disconnect(remote); /* Set up an empty bare repo to push into */ @@ -285,7 +286,7 @@ void test_network_remote_local__push_to_non_bare_remote(void) /* Get some commits */ connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_download(remote, &array)); - cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); + cl_git_pass(git_remote_update_tips(remote, NULL)); git_remote_disconnect(remote); /* Set up an empty non-bare repo to push into */ @@ -319,14 +320,11 @@ void test_network_remote_local__fetch(void) git_reflog *log; const git_reflog_entry *entry; - git_signature *sig; git_reference *ref; - cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com")); - connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_fetch(remote, &array, sig, "UPDAAAAAATE!!")); + cl_git_pass(git_remote_fetch(remote, &array, "UPDAAAAAATE!!")); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); git_reference_free(ref); @@ -338,7 +336,6 @@ void test_network_remote_local__fetch(void) cl_assert_equal_s("UPDAAAAAATE!!", git_reflog_entry_message(entry)); git_reflog_free(log); - git_signature_free(sig); } void test_network_remote_local__reflog(void) @@ -353,14 +350,11 @@ void test_network_remote_local__reflog(void) git_reflog *log; const git_reflog_entry *entry; - git_signature *sig; - - cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com")); connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_download(remote, &array)); - cl_git_pass(git_remote_update_tips(remote, sig, "UPDAAAAAATE!!")); + cl_git_pass(git_remote_update_tips(remote, "UPDAAAAAATE!!")); cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); cl_assert_equal_i(1, git_reflog_entrycount(log)); @@ -369,7 +363,6 @@ void test_network_remote_local__reflog(void) cl_assert_equal_s("UPDAAAAAATE!!", git_reflog_entry_message(entry)); git_reflog_free(log); - git_signature_free(sig); } void test_network_remote_local__fetch_default_reflog_message(void) @@ -384,14 +377,11 @@ void test_network_remote_local__fetch_default_reflog_message(void) git_reflog *log; const git_reflog_entry *entry; - git_signature *sig; char expected_reflog_msg[1024]; - cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com")); - connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_fetch(remote, &array, sig, NULL)); + cl_git_pass(git_remote_fetch(remote, &array, NULL)); cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); cl_assert_equal_i(1, git_reflog_entrycount(log)); @@ -402,7 +392,6 @@ void test_network_remote_local__fetch_default_reflog_message(void) cl_assert_equal_s(expected_reflog_msg, git_reflog_entry_message(entry)); git_reflog_free(log); - git_signature_free(sig); } void test_network_remote_local__opportunistic_update(void) @@ -419,7 +408,7 @@ void test_network_remote_local__opportunistic_update(void) /* this remote has a passive refspec of "refs/heads/<star>:refs/remotes/origin/<star>" */ cl_git_pass(git_remote_create(&remote, repo, "origin", cl_git_fixture_url("testrepo.git"))); /* and we pass the active refspec "master" */ - cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); + cl_git_pass(git_remote_fetch(remote, &array, NULL)); /* and we expect that to update our copy of origin's master */ cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/origin/master")); @@ -445,7 +434,7 @@ void test_network_remote_local__update_tips_for_new_remote(void) { cl_git_pass(git_remote_upload(new_remote, &push_array, NULL)); /* Update tips and make sure remote branch has been created */ - cl_git_pass(git_remote_update_tips(new_remote, NULL, NULL)); + cl_git_pass(git_remote_update_tips(new_remote, NULL)); cl_git_pass(git_branch_lookup(&branch, src_repo, "bare/master", GIT_BRANCH_REMOTE)); git_reference_free(branch); @@ -475,12 +464,12 @@ void test_network_remote_local__push_delete(void) 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, NULL, NULL)); + cl_git_pass(git_remote_push(remote, &specs, NULL, 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, NULL, NULL)); + cl_git_pass(git_remote_push(remote, &specs, NULL, NULL)); cl_git_fail(git_reference_lookup(&ref, dst_repo, "refs/heads/master")); git_remote_free(remote); diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c index 995f1d541..2ae6886bd 100644 --- a/tests/network/remote/remotes.c +++ b/tests/network/remote/remotes.c @@ -272,7 +272,7 @@ void test_network_remote_remotes__nonmatch_upstream_refspec(void) cl_git_pass(git_config_set_string(config, "branch.master.remote", "taggy")); cl_git_pass(git_config_set_string(config, "branch.master.merge", "refs/heads/foo")); - cl_git_pass(git_remote_fetch(remote, &specs, NULL, NULL)); + cl_git_pass(git_remote_fetch(remote, &specs, NULL)); git_remote_free(remote); } @@ -545,7 +545,7 @@ void test_network_remote_remotes__fetch_from_anonymous(void) cl_git_pass(git_remote_create_anonymous(&remote, _repo, cl_fixture("testrepo.git"), "refs/heads/*:refs/other/*")); - cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL)); + cl_git_pass(git_remote_fetch(remote, NULL, NULL)); git_remote_free(remote); } diff --git a/tests/network/remote/rename.c b/tests/network/remote/rename.c index 1dabd07f5..b44a0ae71 100644 --- a/tests/network/remote/rename.c +++ b/tests/network/remote/rename.c @@ -181,7 +181,7 @@ void test_network_remote_rename__overwrite_ref_in_target(void) 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)); + cl_git_pass(git_reference_create(&ref, _repo, "refs/remotes/renamed/master", &id, 1, NULL)); git_reference_free(ref); cl_git_pass(git_remote_rename(&problems, _repo, _remote_name, "renamed")); @@ -219,7 +219,7 @@ void test_network_remote_rename__symref_head(void) char idstr[GIT_OID_HEXSZ + 1] = {0}; git_vector refs; - cl_git_pass(git_reference_symbolic_create(&ref, _repo, "refs/remotes/test/HEAD", "refs/remotes/test/master", 0, NULL, NULL)); + cl_git_pass(git_reference_symbolic_create(&ref, _repo, "refs/remotes/test/HEAD", "refs/remotes/test/master", 0, NULL)); git_reference_free(ref); cl_git_pass(git_remote_rename(&problems, _repo, _remote_name, "renamed")); |
