From 0fe522d1057aef064084a22d116f7c225948a3bd Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Thu, 7 Nov 2013 14:16:20 +0100 Subject: [PATCH 1/4] allowing create remote with custom fetch spec --- include/git2/remote.h | 3 ++- src/clone.c | 2 +- src/remote.c | 11 +++++++---- src/repository.c | 2 +- tests-clar/network/fetchlocal.c | 4 ++-- tests-clar/network/remote/remotes.c | 12 ++++++------ tests-clar/online/clone.c | 2 +- tests-clar/online/fetch.c | 6 +++--- tests-clar/online/push.c | 2 +- tests-clar/refs/branches/remote.c | 2 +- 10 files changed, 25 insertions(+), 21 deletions(-) diff --git a/include/git2/remote.h b/include/git2/remote.h index b9cf86ef1..07102594e 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -40,7 +40,8 @@ GIT_EXTERN(int) git_remote_create( git_remote **out, git_repository *repo, const char *name, - const char *url); + const char *url, + const char *fetch); /** * Create a remote in memory diff --git a/src/clone.c b/src/clone.c index 657243945..8d99e8fc8 100644 --- a/src/clone.c +++ b/src/clone.c @@ -309,7 +309,7 @@ static int create_and_configure_origin( const char *name; name = options->remote_name ? options->remote_name : "origin"; - if ((error = git_remote_create(&origin, repo, name, url)) < 0) + if ((error = git_remote_create(&origin, repo, name, url, NULL)) < 0) goto on_error; if (options->ignore_cert_errors) diff --git a/src/remote.c b/src/remote.c index 3528b1c46..b812c91dd 100644 --- a/src/remote.c +++ b/src/remote.c @@ -174,7 +174,7 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name) } -int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url) +int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch) { git_buf buf = GIT_BUF_INIT; git_remote *remote = NULL; @@ -186,10 +186,13 @@ int git_remote_create(git_remote **out, git_repository *repo, const char *name, if ((error = ensure_remote_doesnot_exist(repo, name)) < 0) return error; - if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0) - return -1; + if (fetch == NULL) { + if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0) + return -1; + fetch = git_buf_cstr(&buf); + } - if (create_internal(&remote, repo, name, url, git_buf_cstr(&buf)) < 0) + if (create_internal(&remote, repo, name, url, fetch) < 0) goto on_error; git_buf_free(&buf); diff --git a/src/repository.c b/src/repository.c index dcc02e4fb..f1eff165c 100644 --- a/src/repository.c +++ b/src/repository.c @@ -1473,7 +1473,7 @@ static int repo_init_create_origin(git_repository *repo, const char *url) int error; git_remote *remote; - if (!(error = git_remote_create(&remote, repo, GIT_REMOTE_ORIGIN, url))) { + if (!(error = git_remote_create(&remote, repo, GIT_REMOTE_ORIGIN, url, NULL))) { git_remote_free(remote); } diff --git a/tests-clar/network/fetchlocal.c b/tests-clar/network/fetchlocal.c index 28c7115bf..8c133d3ad 100644 --- a/tests-clar/network/fetchlocal.c +++ b/tests-clar/network/fetchlocal.c @@ -33,7 +33,7 @@ void test_network_fetchlocal__complete(void) cl_set_cleanup(&cleanup_local_repo, "foo"); cl_git_pass(git_repository_init(&repo, "foo", true)); - cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url)); + cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url, NULL)); git_remote_set_callbacks(origin, &callbacks); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin)); @@ -71,7 +71,7 @@ void test_network_fetchlocal__partial(void) cl_assert_equal_i(1, (int)refnames.count); url = cl_git_fixture_url("testrepo.git"); - cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url)); + cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url, NULL)); git_remote_set_callbacks(origin, &callbacks); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin)); diff --git a/tests-clar/network/remote/remotes.c b/tests-clar/network/remote/remotes.c index 7c79b8318..3b7ce2924 100644 --- a/tests-clar/network/remote/remotes.c +++ b/tests-clar/network/remote/remotes.c @@ -159,7 +159,7 @@ void test_network_remote_remotes__save(void) _remote = NULL; /* Set up the remote and save it to config */ - cl_git_pass(git_remote_create(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2")); + cl_git_pass(git_remote_create(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2", NULL)); git_remote_clear_refspecs(_remote); cl_git_pass(git_remote_add_fetch(_remote, fetch_refspec1)); @@ -298,7 +298,7 @@ void test_network_remote_remotes__add(void) git_remote_free(_remote); _remote = NULL; - cl_git_pass(git_remote_create(&_remote, _repo, "addtest", "http://github.com/libgit2/libgit2")); + cl_git_pass(git_remote_create(&_remote, _repo, "addtest", "http://github.com/libgit2/libgit2", NULL)); cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_AUTO, git_remote_autotag(_remote)); git_remote_free(_remote); @@ -320,7 +320,7 @@ void test_network_remote_remotes__cannot_add_a_nameless_remote(void) cl_assert_equal_i( GIT_EINVALIDSPEC, - git_remote_create(&remote, _repo, NULL, "git://github.com/libgit2/libgit2")); + git_remote_create(&remote, _repo, NULL, "git://github.com/libgit2/libgit2", NULL)); } void test_network_remote_remotes__cannot_save_an_inmemory_remote(void) @@ -341,12 +341,12 @@ void test_network_remote_remotes__cannot_add_a_remote_with_an_invalid_name(void) cl_assert_equal_i( GIT_EINVALIDSPEC, - git_remote_create(&remote, _repo, "Inv@{id", "git://github.com/libgit2/libgit2")); + git_remote_create(&remote, _repo, "Inv@{id", "git://github.com/libgit2/libgit2", NULL)); cl_assert_equal_p(remote, NULL); cl_assert_equal_i( GIT_EINVALIDSPEC, - git_remote_create(&remote, _repo, "", "git://github.com/libgit2/libgit2")); + git_remote_create(&remote, _repo, "", "git://github.com/libgit2/libgit2", NULL)); cl_assert_equal_p(remote, NULL); } @@ -439,7 +439,7 @@ void assert_cannot_create_remote(const char *name, int expected_error) git_remote *remote = NULL; cl_git_fail_with( - git_remote_create(&remote, _repo, name, "git://github.com/libgit2/libgit2"), + git_remote_create(&remote, _repo, name, "git://github.com/libgit2/libgit2", NULL), expected_error); cl_assert_equal_p(remote, NULL); diff --git a/tests-clar/online/clone.c b/tests-clar/online/clone.c index aa3d6b26a..ed8a6446d 100644 --- a/tests-clar/online/clone.c +++ b/tests-clar/online/clone.c @@ -141,7 +141,7 @@ void test_online_clone__clone_into(void) checkout_opts.progress_payload = &checkout_progress_cb_was_called; cl_git_pass(git_repository_init(&g_repo, "./foo", false)); - cl_git_pass(git_remote_create(&remote, g_repo, "origin", LIVE_REPO_URL)); + cl_git_pass(git_remote_create(&remote, g_repo, "origin", LIVE_REPO_URL, NULL)); callbacks.transfer_progress = &fetch_progress; callbacks.payload = &fetch_progress_cb_was_called; diff --git a/tests-clar/online/fetch.c b/tests-clar/online/fetch.c index df1b2e288..3ac9ffa37 100644 --- a/tests-clar/online/fetch.c +++ b/tests-clar/online/fetch.c @@ -43,7 +43,7 @@ static void do_fetch(const char *url, git_remote_autotag_option_t flag, int n) callbacks.payload = &bytes_received; counter = 0; - cl_git_pass(git_remote_create(&remote, _repo, "test", url)); + cl_git_pass(git_remote_create(&remote, _repo, "test", url, NULL)); git_remote_set_callbacks(remote, &callbacks); git_remote_set_autotag(remote, flag); cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); @@ -140,7 +140,7 @@ void test_online_fetch__can_cancel(void) git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; cl_git_pass(git_remote_create(&remote, _repo, "test", - "http://github.com/libgit2/TestGitRepository.git")); + "http://github.com/libgit2/TestGitRepository.git", NULL)); callbacks.transfer_progress = cancel_at_half; callbacks.payload = &bytes_received; @@ -168,7 +168,7 @@ void test_online_fetch__ls_disconnected(void) int nr_before = 0, nr_after = 0; cl_git_pass(git_remote_create(&remote, _repo, "test", - "http://github.com/libgit2/TestGitRepository.git")); + "http://github.com/libgit2/TestGitRepository.git", NULL)); cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_ls(remote, ls_cb, &nr_before)); git_remote_disconnect(remote); diff --git a/tests-clar/online/push.c b/tests-clar/online/push.c index d9ffe8aa9..9f992db75 100644 --- a/tests-clar/online/push.c +++ b/tests-clar/online/push.c @@ -301,7 +301,7 @@ void test_online_push__initialize(void) _remote = NULL; if (_remote_url) { - cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url)); + cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url, NULL)); record_callbacks_data_clear(&_record_cbs_data); git_remote_set_callbacks(_remote, &_record_cbs); diff --git a/tests-clar/refs/branches/remote.c b/tests-clar/refs/branches/remote.c index c110adb33..aeba36347 100644 --- a/tests-clar/refs/branches/remote.c +++ b/tests-clar/refs/branches/remote.c @@ -70,7 +70,7 @@ void test_refs_branches_remote__ambiguous_remote_returns_error(void) git_remote *remote; /* Create the remote */ - cl_git_pass(git_remote_create(&remote, g_repo, "addtest", "http://github.com/libgit2/libgit2")); + cl_git_pass(git_remote_create(&remote, g_repo, "addtest", "http://github.com/libgit2/libgit2", NULL)); /* Update the remote fetch spec */ git_remote_clear_refspecs(remote); From 99feb98897fa1daa0ff3fd70b17ccc9d9a51f1d0 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Thu, 7 Nov 2013 16:22:49 +0100 Subject: [PATCH 2/4] adding doc for new param and test to check fetch spec is correctly added --- include/git2/remote.h | 4 +++- tests-clar/network/remote/remotes.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/git2/remote.h b/include/git2/remote.h index 07102594e..f5e6f5aeb 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -27,13 +27,15 @@ GIT_BEGIN_DECL typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, void *payload); /** - * Add a remote with the default fetch refspec to the repository's configuration. This + * Add a remote with the provided fetch refspec (or default if NULL) to the repository's + * configuration. This * calls git_remote_save before returning. * * @param out the resulting remote * @param repo the repository in which to create the remote * @param name the remote's name * @param url the remote's url + * @param fetch the remote fetch value * @return 0, GIT_EINVALIDSPEC, GIT_EEXISTS or an error code */ GIT_EXTERN(int) git_remote_create( diff --git a/tests-clar/network/remote/remotes.c b/tests-clar/network/remote/remotes.c index 3b7ce2924..210790d4f 100644 --- a/tests-clar/network/remote/remotes.c +++ b/tests-clar/network/remote/remotes.c @@ -450,7 +450,6 @@ void test_network_remote_remotes__cannot_create_a_remote_which_name_conflicts_wi assert_cannot_create_remote("test", GIT_EEXISTS); } - void test_network_remote_remotes__cannot_create_a_remote_which_name_is_invalid(void) { assert_cannot_create_remote("/", GIT_EINVALIDSPEC); @@ -459,6 +458,17 @@ void test_network_remote_remotes__cannot_create_a_remote_which_name_is_invalid(v assert_cannot_create_remote("a.lock", GIT_EINVALIDSPEC); } +void test_network_remote_remotes__create_a_remote_with_custom_fetch_spec(void) +{ + git_remote *remote; + git_strarray array; + + cl_git_pass(git_remote_create(&remote, _repo, "test-new", "git://github.com/libgit2/libgit2", "+refs/*:refs/*")); + git_remote_get_fetch_refspecs(&array, remote); + cl_assert_equal_s("+refs/*:refs/*", array.strings[0]); + git_remote_free(remote); +} + static const char *fetch_refspecs[] = { "+refs/heads/*:refs/remotes/origin/*", "refs/tags/*:refs/tags/*", From 40b99d05b4a1221768c25c889180c12d2f43be8b Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Fri, 8 Nov 2013 12:14:31 +0100 Subject: [PATCH 3/4] splitting funcionality in two methods to avoid ambiguity with NULL --- include/git2/remote.h | 18 ++++++++++++- src/clone.c | 2 +- src/remote.c | 39 ++++++++++++++++++++++++----- src/repository.c | 2 +- tests-clar/network/fetchlocal.c | 4 +-- tests-clar/network/remote/remotes.c | 16 ++++++------ tests-clar/online/clone.c | 2 +- tests-clar/online/fetch.c | 6 ++--- tests-clar/online/push.c | 2 +- tests-clar/refs/branches/remote.c | 2 +- 10 files changed, 68 insertions(+), 25 deletions(-) diff --git a/include/git2/remote.h b/include/git2/remote.h index f5e6f5aeb..116b31e35 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -26,6 +26,22 @@ GIT_BEGIN_DECL typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, void *payload); +/** + * Add a remote with the default fetch refsspec to the repository's configuration. This + * calls git_remote_save before returning. + * + * @param out the resulting remote + * @param repo the repository in which to create the remote + * @param name the remote's name + * @param url the remote's url + * @return 0, GIT_EINVALIDSPEC, GIT_EEXISTS or an error code + */ +GIT_EXTERN(int) git_remote_create( + git_remote **out, + git_repository *repo, + const char *name, + const char *url); + /** * Add a remote with the provided fetch refspec (or default if NULL) to the repository's * configuration. This @@ -38,7 +54,7 @@ typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, voi * @param fetch the remote fetch value * @return 0, GIT_EINVALIDSPEC, GIT_EEXISTS or an error code */ -GIT_EXTERN(int) git_remote_create( +GIT_EXTERN(int) git_remote_create_with_fetchspec( git_remote **out, git_repository *repo, const char *name, diff --git a/src/clone.c b/src/clone.c index 8d99e8fc8..657243945 100644 --- a/src/clone.c +++ b/src/clone.c @@ -309,7 +309,7 @@ static int create_and_configure_origin( const char *name; name = options->remote_name ? options->remote_name : "origin"; - if ((error = git_remote_create(&origin, repo, name, url, NULL)) < 0) + if ((error = git_remote_create(&origin, repo, name, url)) < 0) goto on_error; if (options->ignore_cert_errors) diff --git a/src/remote.c b/src/remote.c index b812c91dd..b97cc9e79 100644 --- a/src/remote.c +++ b/src/remote.c @@ -174,7 +174,7 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name) } -int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch) +int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url) { git_buf buf = GIT_BUF_INIT; git_remote *remote = NULL; @@ -186,11 +186,38 @@ int git_remote_create(git_remote **out, git_repository *repo, const char *name, if ((error = ensure_remote_doesnot_exist(repo, name)) < 0) return error; - if (fetch == NULL) { - if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0) - return -1; - fetch = git_buf_cstr(&buf); - } + if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0) + return -1; + + if (create_internal(&remote, repo, name, url, git_buf_cstr(&buf)) < 0) + goto on_error; + + git_buf_free(&buf); + + if (git_remote_save(remote) < 0) + goto on_error; + + *out = remote; + + return 0; + +on_error: + git_buf_free(&buf); + git_remote_free(remote); + return -1; +} + +int git_remote_create_with_fetchspec(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch) +{ + git_buf buf = GIT_BUF_INIT; + git_remote *remote = NULL; + int error; + + if ((error = ensure_remote_name_is_valid(name)) < 0) + return error; + + if ((error = ensure_remote_doesnot_exist(repo, name)) < 0) + return error; if (create_internal(&remote, repo, name, url, fetch) < 0) goto on_error; diff --git a/src/repository.c b/src/repository.c index f1eff165c..dcc02e4fb 100644 --- a/src/repository.c +++ b/src/repository.c @@ -1473,7 +1473,7 @@ static int repo_init_create_origin(git_repository *repo, const char *url) int error; git_remote *remote; - if (!(error = git_remote_create(&remote, repo, GIT_REMOTE_ORIGIN, url, NULL))) { + if (!(error = git_remote_create(&remote, repo, GIT_REMOTE_ORIGIN, url))) { git_remote_free(remote); } diff --git a/tests-clar/network/fetchlocal.c b/tests-clar/network/fetchlocal.c index 8c133d3ad..28c7115bf 100644 --- a/tests-clar/network/fetchlocal.c +++ b/tests-clar/network/fetchlocal.c @@ -33,7 +33,7 @@ void test_network_fetchlocal__complete(void) cl_set_cleanup(&cleanup_local_repo, "foo"); cl_git_pass(git_repository_init(&repo, "foo", true)); - cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url, NULL)); + cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url)); git_remote_set_callbacks(origin, &callbacks); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin)); @@ -71,7 +71,7 @@ void test_network_fetchlocal__partial(void) cl_assert_equal_i(1, (int)refnames.count); url = cl_git_fixture_url("testrepo.git"); - cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url, NULL)); + cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url)); git_remote_set_callbacks(origin, &callbacks); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin)); diff --git a/tests-clar/network/remote/remotes.c b/tests-clar/network/remote/remotes.c index 210790d4f..954ded82c 100644 --- a/tests-clar/network/remote/remotes.c +++ b/tests-clar/network/remote/remotes.c @@ -159,7 +159,7 @@ void test_network_remote_remotes__save(void) _remote = NULL; /* Set up the remote and save it to config */ - cl_git_pass(git_remote_create(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2", NULL)); + cl_git_pass(git_remote_create(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2")); git_remote_clear_refspecs(_remote); cl_git_pass(git_remote_add_fetch(_remote, fetch_refspec1)); @@ -298,7 +298,7 @@ void test_network_remote_remotes__add(void) git_remote_free(_remote); _remote = NULL; - cl_git_pass(git_remote_create(&_remote, _repo, "addtest", "http://github.com/libgit2/libgit2", NULL)); + cl_git_pass(git_remote_create(&_remote, _repo, "addtest", "http://github.com/libgit2/libgit2")); cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_AUTO, git_remote_autotag(_remote)); git_remote_free(_remote); @@ -320,7 +320,7 @@ void test_network_remote_remotes__cannot_add_a_nameless_remote(void) cl_assert_equal_i( GIT_EINVALIDSPEC, - git_remote_create(&remote, _repo, NULL, "git://github.com/libgit2/libgit2", NULL)); + git_remote_create(&remote, _repo, NULL, "git://github.com/libgit2/libgit2")); } void test_network_remote_remotes__cannot_save_an_inmemory_remote(void) @@ -341,12 +341,12 @@ void test_network_remote_remotes__cannot_add_a_remote_with_an_invalid_name(void) cl_assert_equal_i( GIT_EINVALIDSPEC, - git_remote_create(&remote, _repo, "Inv@{id", "git://github.com/libgit2/libgit2", NULL)); + git_remote_create(&remote, _repo, "Inv@{id", "git://github.com/libgit2/libgit2")); cl_assert_equal_p(remote, NULL); cl_assert_equal_i( GIT_EINVALIDSPEC, - git_remote_create(&remote, _repo, "", "git://github.com/libgit2/libgit2", NULL)); + git_remote_create(&remote, _repo, "", "git://github.com/libgit2/libgit2")); cl_assert_equal_p(remote, NULL); } @@ -439,7 +439,7 @@ void assert_cannot_create_remote(const char *name, int expected_error) git_remote *remote = NULL; cl_git_fail_with( - git_remote_create(&remote, _repo, name, "git://github.com/libgit2/libgit2", NULL), + git_remote_create(&remote, _repo, name, "git://github.com/libgit2/libgit2"), expected_error); cl_assert_equal_p(remote, NULL); @@ -458,12 +458,12 @@ void test_network_remote_remotes__cannot_create_a_remote_which_name_is_invalid(v assert_cannot_create_remote("a.lock", GIT_EINVALIDSPEC); } -void test_network_remote_remotes__create_a_remote_with_custom_fetch_spec(void) +void test_network_remote_remote__git_remote_create_with_fetchspec(void) { git_remote *remote; git_strarray array; - cl_git_pass(git_remote_create(&remote, _repo, "test-new", "git://github.com/libgit2/libgit2", "+refs/*:refs/*")); + cl_git_pass(git_remote_create_with_fetchspec(&remote, _repo, "test-new", "git://github.com/libgit2/libgit2", "+refs/*:refs/*")); git_remote_get_fetch_refspecs(&array, remote); cl_assert_equal_s("+refs/*:refs/*", array.strings[0]); git_remote_free(remote); diff --git a/tests-clar/online/clone.c b/tests-clar/online/clone.c index ed8a6446d..aa3d6b26a 100644 --- a/tests-clar/online/clone.c +++ b/tests-clar/online/clone.c @@ -141,7 +141,7 @@ void test_online_clone__clone_into(void) checkout_opts.progress_payload = &checkout_progress_cb_was_called; cl_git_pass(git_repository_init(&g_repo, "./foo", false)); - cl_git_pass(git_remote_create(&remote, g_repo, "origin", LIVE_REPO_URL, NULL)); + cl_git_pass(git_remote_create(&remote, g_repo, "origin", LIVE_REPO_URL)); callbacks.transfer_progress = &fetch_progress; callbacks.payload = &fetch_progress_cb_was_called; diff --git a/tests-clar/online/fetch.c b/tests-clar/online/fetch.c index 3ac9ffa37..df1b2e288 100644 --- a/tests-clar/online/fetch.c +++ b/tests-clar/online/fetch.c @@ -43,7 +43,7 @@ static void do_fetch(const char *url, git_remote_autotag_option_t flag, int n) callbacks.payload = &bytes_received; counter = 0; - cl_git_pass(git_remote_create(&remote, _repo, "test", url, NULL)); + cl_git_pass(git_remote_create(&remote, _repo, "test", url)); git_remote_set_callbacks(remote, &callbacks); git_remote_set_autotag(remote, flag); cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); @@ -140,7 +140,7 @@ void test_online_fetch__can_cancel(void) git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; cl_git_pass(git_remote_create(&remote, _repo, "test", - "http://github.com/libgit2/TestGitRepository.git", NULL)); + "http://github.com/libgit2/TestGitRepository.git")); callbacks.transfer_progress = cancel_at_half; callbacks.payload = &bytes_received; @@ -168,7 +168,7 @@ void test_online_fetch__ls_disconnected(void) int nr_before = 0, nr_after = 0; cl_git_pass(git_remote_create(&remote, _repo, "test", - "http://github.com/libgit2/TestGitRepository.git", NULL)); + "http://github.com/libgit2/TestGitRepository.git")); cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_ls(remote, ls_cb, &nr_before)); git_remote_disconnect(remote); diff --git a/tests-clar/online/push.c b/tests-clar/online/push.c index 9f992db75..d9ffe8aa9 100644 --- a/tests-clar/online/push.c +++ b/tests-clar/online/push.c @@ -301,7 +301,7 @@ void test_online_push__initialize(void) _remote = NULL; if (_remote_url) { - cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url, NULL)); + cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url)); record_callbacks_data_clear(&_record_cbs_data); git_remote_set_callbacks(_remote, &_record_cbs); diff --git a/tests-clar/refs/branches/remote.c b/tests-clar/refs/branches/remote.c index aeba36347..c110adb33 100644 --- a/tests-clar/refs/branches/remote.c +++ b/tests-clar/refs/branches/remote.c @@ -70,7 +70,7 @@ void test_refs_branches_remote__ambiguous_remote_returns_error(void) git_remote *remote; /* Create the remote */ - cl_git_pass(git_remote_create(&remote, g_repo, "addtest", "http://github.com/libgit2/libgit2", NULL)); + cl_git_pass(git_remote_create(&remote, g_repo, "addtest", "http://github.com/libgit2/libgit2")); /* Update the remote fetch spec */ git_remote_clear_refspecs(remote); From 886cc447389da78885a909a96b43ddbe67c9807f Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Fri, 8 Nov 2013 15:42:52 +0100 Subject: [PATCH 4/4] fixing typo --- include/git2/remote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/git2/remote.h b/include/git2/remote.h index 116b31e35..559b8dcc1 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -27,7 +27,7 @@ GIT_BEGIN_DECL typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, void *payload); /** - * Add a remote with the default fetch refsspec to the repository's configuration. This + * Add a remote with the default fetch refspec to the repository's configuration. This * calls git_remote_save before returning. * * @param out the resulting remote