void test_network_remote_remotes__parsing(void) { git_remote *_remote2 = NULL; cl_assert_equal_s(git_remote_name(_remote), "test"); 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_DIRECTION_FETCH), "git://github.com/libgit2/libgit2"); cl_assert_equal_s(git_remote__urlfordirection(_remote, GIT_DIRECTION_PUSH), "git://github.com/libgit2/libgit2"); cl_git_pass(git_remote_lookup(&_remote2, _repo, "test_with_pushurl")); cl_assert_equal_s(git_remote_name(_remote2), "test_with_pushurl"); 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_DIRECTION_FETCH), "git://github.com/libgit2/fetchlibgit2"); cl_assert_equal_s(git_remote__urlfordirection(_remote2, GIT_DIRECTION_PUSH), "git://github.com/libgit2/pushlibgit2"); git_remote_free(_remote2); }
void test_network_remote_remotes__pushurl(void) { const char *name = git_remote_name(_remote); git_remote *mod; cl_git_pass(git_remote_set_pushurl(_repo, name, "git://github.com/libgit2/notlibgit2")); cl_git_pass(git_remote_lookup(&mod, _repo, name)); cl_assert_equal_s(git_remote_pushurl(mod), "git://github.com/libgit2/notlibgit2"); git_remote_free(mod); cl_git_pass(git_remote_set_pushurl(_repo, name, NULL)); cl_git_pass(git_remote_lookup(&mod, _repo, name)); cl_assert(git_remote_pushurl(mod) == NULL); git_remote_free(mod); }
void test_remote_insteadof__pushurl_insteadof_not_applicable(void) { cl_git_pass(git_repository_open(&g_repo, cl_fixture(REPO_PATH))); cl_git_pass(git_remote_lookup(&g_remote, g_repo, REMOTE_ORIGIN)); cl_assert_equal_p(git_remote_pushurl(g_remote), NULL); }
emacs_value egit_remote_pushurl(emacs_env *env, emacs_value _remote) { EGIT_ASSERT_REMOTE(_remote); git_remote *remote = EGIT_EXTRACT(_remote); const char *url = git_remote_pushurl(remote); if (url) return EM_STRING(url); return em_nil; }
void test_remote_insteadof__pushurl_insteadof_applicable(void) { cl_git_pass(git_repository_open(&g_repo, cl_fixture(REPO_PATH))); cl_git_pass(git_remote_lookup(&g_remote, g_repo, REMOTE_INSTEADOF)); cl_assert_equal_s( git_remote_pushurl(g_remote), "[email protected]:libgit2/libgit2"); }
/* * call-seq: * remote.push_url() -> string or nil * * Returns the remote's url for pushing or nil if no special url for * pushing is set. * remote.push_url #=> "git://github.com/libgit2/rugged.git" */ static VALUE rb_git_remote_push_url(VALUE self) { git_remote *remote; const char * push_url; Data_Get_Struct(self, git_remote, remote); push_url = git_remote_pushurl(remote); return push_url ? rb_str_new_utf8(push_url) : Qnil; }
void test_clone_nonetwork__custom_push_url(void) { const char *url = "http://example.com"; g_options.pushurl = url; cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options)); cl_git_pass(git_remote_load(&g_remote, g_repo, "origin")); cl_assert_equal_s(url, git_remote_pushurl(g_remote)); }
PyObject * Remote_push_url__get__(Remote *self) { const char *url; url = git_remote_pushurl(self->remote); if (!url) Py_RETURN_NONE; return to_unicode(url, NULL, NULL); }
void test_remote_insteadof__anonymous_remote(void) { cl_git_pass(git_repository_open(&g_repo, cl_fixture(REPO_PATH))); cl_git_pass(git_remote_create_anonymous(&g_remote, g_repo, "http://example.com/libgit2/libgit2")); cl_assert_equal_s( git_remote_url(g_remote), "http://github.com/libgit2/libgit2"); cl_assert_equal_p(git_remote_pushurl(g_remote), NULL); }
void test_network_remote_remotes__dup(void) { git_strarray array; git_remote *dup; cl_git_pass(git_remote_dup(&dup, _remote)); cl_assert_equal_s(git_remote_name(dup), git_remote_name(_remote)); cl_assert_equal_s(git_remote_url(dup), git_remote_url(_remote)); cl_assert_equal_s(git_remote_pushurl(dup), git_remote_pushurl(_remote)); cl_git_pass(git_remote_get_fetch_refspecs(&array, _remote)); cl_assert_equal_i(1, (int)array.count); cl_assert_equal_s("+refs/heads/*:refs/remotes/test/*", array.strings[0]); git_strarray_free(&array); cl_git_pass(git_remote_get_push_refspecs(&array, _remote)); cl_assert_equal_i(0, (int)array.count); git_strarray_free(&array); git_remote_free(dup); }