void test_network_remote_remotes__initialize(void) { _repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_remote_lookup(&_remote, _repo, "test")); _refspec = git_remote_get_refspec(_remote, 0); cl_assert(_refspec != NULL); }
emacs_value egit_remote_get_refspec(emacs_env *env, emacs_value _remote, emacs_value _index) { EGIT_ASSERT_REMOTE(_remote); EM_ASSERT_INTEGER(_index); git_remote *remote = EGIT_EXTRACT(_remote); intmax_t index = EM_EXTRACT_INTEGER(_index); const git_refspec *refspec = git_remote_get_refspec(remote, index); if (!refspec) { em_signal_args_out_of_range(env, index); return em_nil; } return egit_wrap(env, EGIT_REFSPEC, refspec, EM_EXTRACT_USER_PTR(_remote)); }
PyObject * Remote_get_refspec(Remote *self, PyObject *value) { size_t n; const git_refspec *refspec; n = PyLong_AsSize_t(value); if (PyErr_Occurred()) return NULL; refspec = git_remote_get_refspec(self->remote, n); if (refspec == NULL) { PyErr_SetObject(PyExc_IndexError, value); return NULL; } return (PyObject*) wrap_refspec(self, refspec); }
void test_network_remote_remotes__add_pushspec(void) { size_t size; size = git_remote_refspec_count(_remote); cl_git_pass(git_remote_add_push(_repo, "test", "refs/*:refs/*")); size++; git_remote_free(_remote); cl_git_pass(git_remote_lookup(&_remote, _repo, "test")); cl_assert_equal_i((int)size, (int)git_remote_refspec_count(_remote)); _refspec = git_remote_get_refspec(_remote, size - 1); cl_assert_equal_s(git_refspec_src(_refspec), "refs/*"); cl_assert_equal_s(git_refspec_dst(_refspec), "refs/*"); cl_assert_equal_s(git_refspec_string(_refspec), "refs/*:refs/*"); cl_assert_equal_b(_refspec->push, true); }
void test_network_remote_remotes__add_fetchspec(void) { size_t size; size = git_remote_refspec_count(_remote); cl_git_pass(git_remote_add_fetch(_repo, "test", "refs/*:refs/*")); size++; git_remote_free(_remote); cl_git_pass(git_remote_lookup(&_remote, _repo, "test")); cl_assert_equal_i((int)size, (int)git_remote_refspec_count(_remote)); _refspec = git_remote_get_refspec(_remote, size - 1); cl_assert_equal_s(git_refspec_src(_refspec), "refs/*"); cl_assert_equal_s(git_refspec_dst(_refspec), "refs/*"); cl_assert_equal_s(git_refspec_string(_refspec), "refs/*:refs/*"); cl_assert_equal_b(_refspec->push, false); cl_git_fail_with(GIT_EINVALIDSPEC, git_remote_add_fetch(_repo, "test", "refs/*/foo/*:refs/*")); }