diff options
| author | Ben Straub <bs@github.com> | 2014-02-04 20:38:13 -0800 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2014-02-04 20:38:13 -0800 |
| commit | c3ab1e5af4c43d1031969fbb12c559a55c5baf05 (patch) | |
| tree | daa3c47ca9e638f284b7563d7b9eda065f1a2808 /tests | |
| parent | 491cecfe8ce4c6fbee3357248c7b688b6e1aaab4 (diff) | |
| download | libgit2-c3ab1e5af4c43d1031969fbb12c559a55c5baf05.tar.gz | |
Add reflog parameters to remote apis
Also added a test for git_remote_fetch.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/network/fetchlocal.c | 4 | ||||
| -rw-r--r-- | tests/network/remote/local.c | 67 | ||||
| -rw-r--r-- | tests/online/fetch.c | 4 | ||||
| -rw-r--r-- | tests/online/fetchhead.c | 2 | ||||
| -rw-r--r-- | tests/online/push.c | 2 |
5 files changed, 67 insertions, 12 deletions
diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c index 28c7115bf..4c39394bb 100644 --- a/tests/network/fetchlocal.c +++ b/tests/network/fetchlocal.c @@ -37,7 +37,7 @@ void test_network_fetchlocal__complete(void) git_remote_set_callbacks(origin, &callbacks); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin)); - cl_git_pass(git_remote_update_tips(origin)); + cl_git_pass(git_remote_update_tips(origin, NULL, NULL)); cl_git_pass(git_reference_list(&refnames, repo)); cl_assert_equal_i(19, (int)refnames.count); @@ -75,7 +75,7 @@ void test_network_fetchlocal__partial(void) git_remote_set_callbacks(origin, &callbacks); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin)); - cl_git_pass(git_remote_update_tips(origin)); + cl_git_pass(git_remote_update_tips(origin, NULL, NULL)); git_strarray_free(&refnames); diff --git a/tests/network/remote/local.c b/tests/network/remote/local.c index 9b9f716b9..526564721 100644 --- a/tests/network/remote/local.c +++ b/tests/network/remote/local.c @@ -115,7 +115,7 @@ void test_network_remote_local__shorthand_fetch_refspec0(void) cl_git_pass(git_remote_add_fetch(remote, refspec2)); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); git_reference_free(ref); @@ -137,7 +137,7 @@ void test_network_remote_local__shorthand_fetch_refspec1(void) cl_git_pass(git_remote_add_fetch(remote, refspec2)); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); @@ -152,7 +152,7 @@ void test_network_remote_local__tagopt(void) git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_ALL); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); @@ -171,7 +171,7 @@ void test_network_remote_local__push_to_bare_remote(void) connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_add_fetch(remote, "master:master")); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); /* Set up an empty bare repo to push into */ @@ -208,7 +208,7 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void) connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_add_fetch(remote, "master:master")); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); /* Set up an empty bare repo to push into */ @@ -248,7 +248,7 @@ void test_network_remote_local__push_to_non_bare_remote(void) connect_to_local_repository(cl_fixture("testrepo.git")); cl_git_pass(git_remote_add_fetch(remote, "master:master")); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); /* Set up an empty non-bare repo to push into */ @@ -273,3 +273,58 @@ void test_network_remote_local__push_to_non_bare_remote(void) git_remote_free(localremote); cl_fixture_cleanup("localbare.git"); } + +void test_network_remote_local__fetch(void) +{ + const char *refspec = "master:remotes/sloppy/master"; + + 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_add_fetch(remote, refspec)); + + cl_git_pass(git_remote_fetch(remote, sig, "UPDAAAAAATE!!")); + + cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); + git_reference_free(ref); + + cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); + cl_assert_equal_i(1, git_reflog_entrycount(log)); + entry = git_reflog_entry_byindex(log, 0); + cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email); + 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) +{ + const char *refspec = "master:remotes/sloppy/master"; + + 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_add_fetch(remote, refspec)); + + cl_git_pass(git_remote_download(remote)); + cl_git_pass(git_remote_update_tips(remote, sig, "UPDAAAAAATE!!")); + + cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); + cl_assert_equal_i(1, git_reflog_entrycount(log)); + entry = git_reflog_entry_byindex(log, 0); + cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email); + cl_assert_equal_s("UPDAAAAAATE!!", git_reflog_entry_message(entry)); + + git_reflog_free(log); + git_signature_free(sig); +} diff --git a/tests/online/fetch.c b/tests/online/fetch.c index 8f71cf3f5..cb84e846c 100644 --- a/tests/online/fetch.c +++ b/tests/online/fetch.c @@ -48,7 +48,7 @@ static void do_fetch(const char *url, git_remote_autotag_option_t flag, int n) git_remote_set_autotag(remote, flag); cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); cl_assert_equal_i(counter, n); cl_assert(bytes_received > 0); @@ -117,7 +117,7 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date cl_assert_equal_i(false, invoked); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); git_remote_free(remote); diff --git a/tests/online/fetchhead.c b/tests/online/fetchhead.c index 57b183f88..0b3f20db1 100644 --- a/tests/online/fetchhead.c +++ b/tests/online/fetchhead.c @@ -51,7 +51,7 @@ static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fet cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(remote)); - cl_git_pass(git_remote_update_tips(remote)); + cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); git_remote_free(remote); diff --git a/tests/online/push.c b/tests/online/push.c index c0ff2f22c..9f85ab419 100644 --- a/tests/online/push.c +++ b/tests/online/push.c @@ -351,7 +351,7 @@ void test_online_push__initialize(void) /* Now that we've deleted everything, fetch from the remote */ cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(_remote)); - cl_git_pass(git_remote_update_tips(_remote)); + cl_git_pass(git_remote_update_tips(_remote, NULL, NULL)); git_remote_disconnect(_remote); } else printf("GITTEST_REMOTE_URL unset; skipping push test\n"); |
