diff --git a/examples/network/fetch.c b/examples/network/fetch.c index 9d1404ab4..e341d2d6c 100644 --- a/examples/network/fetch.c +++ b/examples/network/fetch.c @@ -25,7 +25,7 @@ static void *download(void *ptr) // Connect to the remote end specifying that we want to fetch // information from it. - if (git_remote_connect(data->remote, GIT_DIR_FETCH) < 0) { + if (git_remote_connect(data->remote, GIT_DIRECTION_FETCH) < 0) { data->ret = -1; goto exit; } diff --git a/examples/network/ls-remote.c b/examples/network/ls-remote.c index 822d6f668..62131d4ba 100644 --- a/examples/network/ls-remote.c +++ b/examples/network/ls-remote.c @@ -27,7 +27,7 @@ static int use_unnamed(git_repository *repo, const char *url) // When connecting, the underlying code needs to know wether we // want to push or fetch - error = git_remote_connect(remote, GIT_DIR_FETCH); + error = git_remote_connect(remote, GIT_DIRECTION_FETCH); if (error < 0) goto cleanup; @@ -49,7 +49,7 @@ static int use_remote(git_repository *repo, char *name) if (error < 0) goto cleanup; - error = git_remote_connect(remote, GIT_DIR_FETCH); + error = git_remote_connect(remote, GIT_DIRECTION_FETCH); if (error < 0) goto cleanup; diff --git a/include/git2/net.h b/include/git2/net.h index 734ee708f..2543ff8e0 100644 --- a/include/git2/net.h +++ b/include/git2/net.h @@ -27,8 +27,10 @@ GIT_BEGIN_DECL * gets called. */ -#define GIT_DIR_FETCH 0 -#define GIT_DIR_PUSH 1 +typedef enum { + GIT_DIRECTION_FETCH = 0, + GIT_DIRECTION_PUSH = 1 +} git_direction; /** diff --git a/include/git2/remote.h b/include/git2/remote.h index 44390e7a4..e7d06b6e1 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -24,6 +24,7 @@ */ GIT_BEGIN_DECL +typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, void *payload); /* * TODO: This functions still need to be implemented: * - _listcb/_foreach @@ -71,7 +72,7 @@ GIT_EXTERN(int) git_remote_save(const git_remote *remote); * @param remote the remote * @return a pointer to the name */ -GIT_EXTERN(const char *) git_remote_name(git_remote *remote); +GIT_EXTERN(const char *) git_remote_name(const git_remote *remote); /** * Get the remote's url @@ -79,7 +80,7 @@ GIT_EXTERN(const char *) git_remote_name(git_remote *remote); * @param remote the remote * @return a pointer to the url */ -GIT_EXTERN(const char *) git_remote_url(git_remote *remote); +GIT_EXTERN(const char *) git_remote_url(const git_remote *remote); /** * Get the remote's url for pushing @@ -87,7 +88,7 @@ GIT_EXTERN(const char *) git_remote_url(git_remote *remote); * @param remote the remote * @return a pointer to the url or NULL if no special url for pushing is set */ -GIT_EXTERN(const char *) git_remote_pushurl(git_remote *remote); +GIT_EXTERN(const char *) git_remote_pushurl(const git_remote *remote); /** * Set the remote's url @@ -126,7 +127,7 @@ GIT_EXTERN(int) git_remote_set_fetchspec(git_remote *remote, const char *spec); * @param remote the remote * @return a pointer to the fetch refspec or NULL if it doesn't exist */ -GIT_EXTERN(const git_refspec *) git_remote_fetchspec(git_remote *remote); +GIT_EXTERN(const git_refspec *) git_remote_fetchspec(const git_remote *remote); /** * Set the remote's push refspec @@ -144,7 +145,7 @@ GIT_EXTERN(int) git_remote_set_pushspec(git_remote *remote, const char *spec); * @return a pointer to the push refspec or NULL if it doesn't exist */ -GIT_EXTERN(const git_refspec *) git_remote_pushspec(git_remote *remote); +GIT_EXTERN(const git_refspec *) git_remote_pushspec(const git_remote *remote); /** * Open a connection to a remote @@ -157,7 +158,7 @@ GIT_EXTERN(const git_refspec *) git_remote_pushspec(git_remote *remote); * @param direction whether you want to receive or send data * @return 0 or an error code */ -GIT_EXTERN(int) git_remote_connect(git_remote *remote, int direction); +GIT_EXTERN(int) git_remote_connect(git_remote *remote, git_direction direction); /** * Get a list of refs at the remote @@ -194,7 +195,7 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void GIT_EXTERN(int) git_remote_download( git_remote *remote, git_transfer_progress_callback progress_cb, - void *progress_payload); + void *payload); /** * Check whether the remote is connected @@ -266,11 +267,11 @@ GIT_EXTERN(int) git_remote_supported_url(const char* url); * * The string array must be freed by the user. * - * @param remotes_list a string array with the names of the remotes + * @param out a string array which receives the names of the remotes * @param repo the repository to query * @return 0 or an error code */ -GIT_EXTERN(int) git_remote_list(git_strarray *remotes_list, git_repository *repo); +GIT_EXTERN(int) git_remote_list(git_strarray *out, git_repository *repo); /** * Add a remote with the default fetch refspec to the repository's configuration @@ -340,7 +341,7 @@ struct git_remote_callbacks { void (*progress)(const char *str, int len, void *data); int (*completion)(git_remote_completion_type type, void *data); int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data); - void *data; + void *payload; }; /** @@ -398,7 +399,7 @@ GIT_EXTERN(void) git_remote_set_autotag(git_remote *remote, int value); GIT_EXTERN(int) git_remote_rename( git_remote *remote, const char *new_name, - int (*callback)(const char *problematic_refspec, void *payload), + git_remote_rename_problem_cb callback, void *payload); /** diff --git a/src/clone.c b/src/clone.c index c90d85466..7d49b398b 100644 --- a/src/clone.c +++ b/src/clone.c @@ -278,7 +278,7 @@ static int setup_remotes_and_fetch( git_remote_set_update_fetchhead(origin, 0); /* Connect and download everything */ - if (!git_remote_connect(origin, GIT_DIR_FETCH)) { + if (!git_remote_connect(origin, GIT_DIRECTION_FETCH)) { if (!git_remote_download(origin, progress_cb, progress_payload)) { /* Create "origin/foo" branches for all remote branches */ if (!git_remote_update_tips(origin)) { diff --git a/src/remote.c b/src/remote.c index 5035588a3..2f7c89471 100644 --- a/src/remote.c +++ b/src/remote.c @@ -252,7 +252,7 @@ static int update_config_refspec( &name, "remote.%s.%s", remote_name, - git_direction == GIT_DIR_FETCH ? "fetch" : "push") < 0) + git_direction == GIT_DIRECTION_FETCH ? "fetch" : "push") < 0) goto cleanup; if (git_refspec__serialize(&value, refspec) < 0) @@ -318,14 +318,14 @@ int git_remote_save(const git_remote *remote) config, remote->name, &remote->fetch, - GIT_DIR_FETCH) < 0) + GIT_DIRECTION_FETCH) < 0) goto on_error; if (update_config_refspec( config, remote->name, &remote->push, - GIT_DIR_PUSH) < 0) + GIT_DIRECTION_PUSH) < 0) goto on_error; /* @@ -369,13 +369,13 @@ on_error: return -1; } -const char *git_remote_name(git_remote *remote) +const char *git_remote_name(const git_remote *remote) { assert(remote); return remote->name; } -const char *git_remote_url(git_remote *remote) +const char *git_remote_url(const git_remote *remote) { assert(remote); return remote->url; @@ -393,7 +393,7 @@ int git_remote_set_url(git_remote *remote, const char* url) return 0; } -const char *git_remote_pushurl(git_remote *remote) +const char *git_remote_pushurl(const git_remote *remote) { assert(remote); return remote->pushurl; @@ -429,7 +429,7 @@ int git_remote_set_fetchspec(git_remote *remote, const char *spec) return 0; } -const git_refspec *git_remote_fetchspec(git_remote *remote) +const git_refspec *git_remote_fetchspec(const git_remote *remote) { assert(remote); return &remote->fetch; @@ -451,7 +451,7 @@ int git_remote_set_pushspec(git_remote *remote, const char *spec) return 0; } -const git_refspec *git_remote_pushspec(git_remote *remote) +const git_refspec *git_remote_pushspec(const git_remote *remote) { assert(remote); return &remote->push; @@ -461,18 +461,18 @@ const char* git_remote__urlfordirection(git_remote *remote, int direction) { assert(remote); - if (direction == GIT_DIR_FETCH) { + if (direction == GIT_DIRECTION_FETCH) { return remote->url; } - if (direction == GIT_DIR_PUSH) { + if (direction == GIT_DIRECTION_PUSH) { return remote->pushurl ? remote->pushurl : remote->url; } return NULL; } -int git_remote_connect(git_remote *remote, int direction) +int git_remote_connect(git_remote *remote, git_direction direction) { git_transport *t; const char *url; @@ -492,7 +492,7 @@ int git_remote_connect(git_remote *remote, int direction) return -1; if (t->set_callbacks && - t->set_callbacks(t, remote->callbacks.progress, NULL, remote->callbacks.data) < 0) + t->set_callbacks(t, remote->callbacks.progress, NULL, remote->callbacks.payload) < 0) goto on_error; if (!remote->check_cert) @@ -753,7 +753,7 @@ int git_remote_update_tips(git_remote *remote) git_reference_free(ref); if (remote->callbacks.update_tips != NULL) { - if (remote->callbacks.update_tips(refname.ptr, &old, &head->oid, remote->callbacks.data) < 0) + if (remote->callbacks.update_tips(refname.ptr, &old, &head->oid, remote->callbacks.payload) < 0) goto on_error; } } @@ -936,7 +936,7 @@ void git_remote_set_callbacks(git_remote *remote, git_remote_callbacks *callback remote->transport->set_callbacks(remote->transport, remote->callbacks.progress, NULL, - remote->callbacks.data); + remote->callbacks.payload); } void git_remote_set_cred_acquire_cb( @@ -1194,7 +1194,7 @@ static int rename_fetch_refspecs( if (git_repository_config__weakptr(&config, remote->repo) < 0) goto cleanup; - error = update_config_refspec(config, new_name, &remote->fetch, GIT_DIR_FETCH); + error = update_config_refspec(config, new_name, &remote->fetch, GIT_DIRECTION_FETCH); cleanup: git_buf_free(&serialized); @@ -1205,7 +1205,7 @@ cleanup: int git_remote_rename( git_remote *remote, const char *new_name, - int (*callback)(const char *problematic_refspec, void *payload), + git_remote_rename_problem_cb callback, void *payload) { int error; diff --git a/src/transports/smart.c b/src/transports/smart.c index 195ea285c..e8dbbef5c 100644 --- a/src/transports/smart.c +++ b/src/transports/smart.c @@ -73,7 +73,7 @@ static int git_smart__connect( t->flags = flags; t->cred_acquire_cb = cred_acquire_cb; - if (GIT_DIR_FETCH == direction) + if (GIT_DIRECTION_FETCH == direction) { if ((error = t->wrapped->action(&stream, t->wrapped, t->url, GIT_SERVICE_UPLOADPACK_LS)) < 0) return error; @@ -159,7 +159,7 @@ int git_smart__negotiation_step(git_transport *transport, void *data, size_t len if (t->rpc) git_smart__reset_stream(t); - if (GIT_DIR_FETCH == t->direction) { + if (GIT_DIRECTION_FETCH == t->direction) { if ((error = t->wrapped->action(&stream, t->wrapped, t->url, GIT_SERVICE_UPLOADPACK)) < 0) return error; diff --git a/tests-clar/fetchhead/network.c b/tests-clar/fetchhead/network.c index 0710480cd..46cb977e0 100644 --- a/tests-clar/fetchhead/network.c +++ b/tests-clar/fetchhead/network.c @@ -46,7 +46,7 @@ static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fet if(fetchspec != NULL) git_remote_set_fetchspec(remote, fetchspec); - cl_git_pass(git_remote_connect(remote, GIT_DIR_FETCH)); + cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(remote, NULL, NULL)); cl_git_pass(git_remote_update_tips(remote)); git_remote_disconnect(remote); diff --git a/tests-clar/network/fetch.c b/tests-clar/network/fetch.c index a575b18ca..81a0eed25 100644 --- a/tests-clar/network/fetch.c +++ b/tests-clar/network/fetch.c @@ -46,7 +46,7 @@ static void do_fetch(const char *url, int flag, int n) cl_git_pass(git_remote_add(&remote, _repo, "test", url)); git_remote_set_callbacks(remote, &callbacks); git_remote_set_autotag(remote, flag); - cl_git_pass(git_remote_connect(remote, GIT_DIR_FETCH)); + cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(remote, progress, &bytes_received)); git_remote_disconnect(remote); cl_git_pass(git_remote_update_tips(remote)); diff --git a/tests-clar/network/fetchlocal.c b/tests-clar/network/fetchlocal.c index a0369d040..018531c5c 100644 --- a/tests-clar/network/fetchlocal.c +++ b/tests-clar/network/fetchlocal.c @@ -22,7 +22,7 @@ void test_network_fetchlocal__complete(void) cl_git_pass(git_repository_init(&repo, "foo", true)); cl_git_pass(git_remote_add(&origin, repo, GIT_REMOTE_ORIGIN, url)); - cl_git_pass(git_remote_connect(origin, GIT_DIR_FETCH)); + cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin, transfer_cb, &callcount)); cl_git_pass(git_remote_update_tips(origin)); @@ -48,7 +48,7 @@ void test_network_fetchlocal__partial(void) url = cl_git_fixture_url("testrepo.git"); cl_git_pass(git_remote_add(&origin, repo, GIT_REMOTE_ORIGIN, url)); - cl_git_pass(git_remote_connect(origin, GIT_DIR_FETCH)); + cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_download(origin, transfer_cb, &callcount)); cl_git_pass(git_remote_update_tips(origin)); diff --git a/tests-clar/network/refspecs.c b/tests-clar/network/refspecs.c index 3b1281722..b3d80fb85 100644 --- a/tests-clar/network/refspecs.c +++ b/tests-clar/network/refspecs.c @@ -7,7 +7,7 @@ static void assert_refspec(unsigned int direction, const char *input, bool is_ex git_refspec refspec; int error; - error = git_refspec__parse(&refspec, input, direction == GIT_DIR_FETCH); + error = git_refspec__parse(&refspec, input, direction == GIT_DIRECTION_FETCH); git_refspec__free(&refspec); if (is_expected_to_be_valid) @@ -20,19 +20,19 @@ void test_network_refspecs__parsing(void) { // Ported from https://github.com/git/git/blob/abd2bde78bd994166900290434a2048e660dabed/t/t5511-refspec.sh - assert_refspec(GIT_DIR_PUSH, "", false); - assert_refspec(GIT_DIR_PUSH, ":", true); - assert_refspec(GIT_DIR_PUSH, "::", false); - assert_refspec(GIT_DIR_PUSH, "+:", true); + assert_refspec(GIT_DIRECTION_PUSH, "", false); + assert_refspec(GIT_DIRECTION_PUSH, ":", true); + assert_refspec(GIT_DIRECTION_PUSH, "::", false); + assert_refspec(GIT_DIRECTION_PUSH, "+:", true); - assert_refspec(GIT_DIR_FETCH, "", true); - assert_refspec(GIT_DIR_PUSH, ":", true); - assert_refspec(GIT_DIR_FETCH, "::", false); + assert_refspec(GIT_DIRECTION_FETCH, "", true); + assert_refspec(GIT_DIRECTION_PUSH, ":", true); + assert_refspec(GIT_DIRECTION_FETCH, "::", false); - assert_refspec(GIT_DIR_PUSH, "refs/heads/*:refs/remotes/frotz/*", true); - assert_refspec(GIT_DIR_PUSH, "refs/heads/*:refs/remotes/frotz", false); - assert_refspec(GIT_DIR_PUSH, "refs/heads:refs/remotes/frotz/*", false); - assert_refspec(GIT_DIR_PUSH, "refs/heads/master:refs/remotes/frotz/xyzzy", true); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/*:refs/remotes/frotz/*", true); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/*:refs/remotes/frotz", false); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads:refs/remotes/frotz/*", false); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/master:refs/remotes/frotz/xyzzy", true); /* * These have invalid LHS, but we do not have a formal "valid sha-1 @@ -40,45 +40,45 @@ void test_network_refspecs__parsing(void) * code. They will be caught downstream anyway, but we may want to * have tighter check later... */ - //assert_refspec(GIT_DIR_PUSH, "refs/heads/master::refs/remotes/frotz/xyzzy", false); - //assert_refspec(GIT_DIR_PUSH, "refs/heads/maste :refs/remotes/frotz/xyzzy", false); + //assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/master::refs/remotes/frotz/xyzzy", false); + //assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/maste :refs/remotes/frotz/xyzzy", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/*:refs/remotes/frotz/*", true); - assert_refspec(GIT_DIR_FETCH, "refs/heads/*:refs/remotes/frotz", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads:refs/remotes/frotz/*", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/master:refs/remotes/frotz/xyzzy", true); - assert_refspec(GIT_DIR_FETCH, "refs/heads/master::refs/remotes/frotz/xyzzy", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/maste :refs/remotes/frotz/xyzzy", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/*:refs/remotes/frotz/*", true); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/*:refs/remotes/frotz", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads:refs/remotes/frotz/*", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/master:refs/remotes/frotz/xyzzy", true); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/master::refs/remotes/frotz/xyzzy", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/maste :refs/remotes/frotz/xyzzy", false); - assert_refspec(GIT_DIR_PUSH, "master~1:refs/remotes/frotz/backup", true); - assert_refspec(GIT_DIR_FETCH, "master~1:refs/remotes/frotz/backup", false); - assert_refspec(GIT_DIR_PUSH, "HEAD~4:refs/remotes/frotz/new", true); - assert_refspec(GIT_DIR_FETCH, "HEAD~4:refs/remotes/frotz/new", false); + assert_refspec(GIT_DIRECTION_PUSH, "master~1:refs/remotes/frotz/backup", true); + assert_refspec(GIT_DIRECTION_FETCH, "master~1:refs/remotes/frotz/backup", false); + assert_refspec(GIT_DIRECTION_PUSH, "HEAD~4:refs/remotes/frotz/new", true); + assert_refspec(GIT_DIRECTION_FETCH, "HEAD~4:refs/remotes/frotz/new", false); - assert_refspec(GIT_DIR_PUSH, "HEAD", true); - assert_refspec(GIT_DIR_FETCH, "HEAD", true); - assert_refspec(GIT_DIR_PUSH, "refs/heads/ nitfol", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/ nitfol", false); + assert_refspec(GIT_DIRECTION_PUSH, "HEAD", true); + assert_refspec(GIT_DIRECTION_FETCH, "HEAD", true); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/ nitfol", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/ nitfol", false); - assert_refspec(GIT_DIR_PUSH, "HEAD:", false); - assert_refspec(GIT_DIR_FETCH, "HEAD:", true); - assert_refspec(GIT_DIR_PUSH, "refs/heads/ nitfol:", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/ nitfol:", false); + assert_refspec(GIT_DIRECTION_PUSH, "HEAD:", false); + assert_refspec(GIT_DIRECTION_FETCH, "HEAD:", true); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/ nitfol:", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/ nitfol:", false); - assert_refspec(GIT_DIR_PUSH, ":refs/remotes/frotz/deleteme", true); - assert_refspec(GIT_DIR_FETCH, ":refs/remotes/frotz/HEAD-to-me", true); - assert_refspec(GIT_DIR_PUSH, ":refs/remotes/frotz/delete me", false); - assert_refspec(GIT_DIR_FETCH, ":refs/remotes/frotz/HEAD to me", false); + assert_refspec(GIT_DIRECTION_PUSH, ":refs/remotes/frotz/deleteme", true); + assert_refspec(GIT_DIRECTION_FETCH, ":refs/remotes/frotz/HEAD-to-me", true); + assert_refspec(GIT_DIRECTION_PUSH, ":refs/remotes/frotz/delete me", false); + assert_refspec(GIT_DIRECTION_FETCH, ":refs/remotes/frotz/HEAD to me", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/*/for-linus:refs/remotes/mine/*-blah", false); - assert_refspec(GIT_DIR_PUSH, "refs/heads/*/for-linus:refs/remotes/mine/*-blah", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/*/for-linus:refs/remotes/mine/*-blah", false); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/*/for-linus:refs/remotes/mine/*-blah", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads*/for-linus:refs/remotes/mine/*", false); - assert_refspec(GIT_DIR_PUSH, "refs/heads*/for-linus:refs/remotes/mine/*", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads*/for-linus:refs/remotes/mine/*", false); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads*/for-linus:refs/remotes/mine/*", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/*/*/for-linus:refs/remotes/mine/*", false); - assert_refspec(GIT_DIR_PUSH, "refs/heads/*/*/for-linus:refs/remotes/mine/*", false); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/*/*/for-linus:refs/remotes/mine/*", false); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/*/*/for-linus:refs/remotes/mine/*", false); - assert_refspec(GIT_DIR_FETCH, "refs/heads/*/for-linus:refs/remotes/mine/*", true); - assert_refspec(GIT_DIR_PUSH, "refs/heads/*/for-linus:refs/remotes/mine/*", true); + assert_refspec(GIT_DIRECTION_FETCH, "refs/heads/*/for-linus:refs/remotes/mine/*", true); + assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/*/for-linus:refs/remotes/mine/*", true); } diff --git a/tests-clar/network/remotelocal.c b/tests-clar/network/remotelocal.c index f7dcfc0e6..8376b8bf1 100644 --- a/tests-clar/network/remotelocal.c +++ b/tests-clar/network/remotelocal.c @@ -51,7 +51,7 @@ static void connect_to_local_repository(const char *local_repository) git_buf_sets(&file_path_buf, cl_git_path_url(local_repository)); cl_git_pass(git_remote_new(&remote, repo, NULL, git_buf_cstr(&file_path_buf), NULL)); - cl_git_pass(git_remote_connect(remote, GIT_DIR_FETCH)); + cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); } diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c index 4fe3ebed9..14fda1670 100644 --- a/tests-clar/network/remotes.c +++ b/tests-clar/network/remotes.c @@ -33,9 +33,9 @@ void test_network_remotes__parsing(void) cl_assert_equal_s(git_remote_url(_remote), "git://github.com/libgit2/libgit2"); cl_assert(git_remote_pushurl(_remote) == NULL); - cl_assert_equal_s(git_remote__urlfordirection(_remote, GIT_DIR_FETCH), + cl_assert_equal_s(git_remote__urlfordirection(_remote, GIT_DIRECTION_FETCH), "git://github.com/libgit2/libgit2"); - cl_assert_equal_s(git_remote__urlfordirection(_remote, GIT_DIR_PUSH), + cl_assert_equal_s(git_remote__urlfordirection(_remote, GIT_DIRECTION_PUSH), "git://github.com/libgit2/libgit2"); cl_git_pass(git_remote_load(&_remote2, _repo, "test_with_pushurl")); @@ -43,9 +43,9 @@ void test_network_remotes__parsing(void) cl_assert_equal_s(git_remote_url(_remote2), "git://github.com/libgit2/fetchlibgit2"); cl_assert_equal_s(git_remote_pushurl(_remote2), "git://github.com/libgit2/pushlibgit2"); - cl_assert_equal_s(git_remote__urlfordirection(_remote2, GIT_DIR_FETCH), + cl_assert_equal_s(git_remote__urlfordirection(_remote2, GIT_DIRECTION_FETCH), "git://github.com/libgit2/fetchlibgit2"); - cl_assert_equal_s(git_remote__urlfordirection(_remote2, GIT_DIR_PUSH), + cl_assert_equal_s(git_remote__urlfordirection(_remote2, GIT_DIRECTION_PUSH), "git://github.com/libgit2/pushlibgit2"); git_remote_free(_remote2);