diff options
| author | Vicent Martà <tanoku@gmail.com> | 2012-02-20 11:35:08 -0800 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2012-02-20 11:35:08 -0800 |
| commit | 481f5e2721f4504f4c7daece5045730f7fd3fb3c (patch) | |
| tree | 28d4caef9c691ea682b456a4f55da74c011ce51f /tests-clar | |
| parent | 555c81f3356b8166c09f887450eac008b221cdc3 (diff) | |
| parent | f0f3a18af66cd1d09b407748e6db0ab3707778bf (diff) | |
| download | libgit2-481f5e2721f4504f4c7daece5045730f7fd3fb3c.tar.gz | |
Merge pull request #568 from carlosmn/remotes
Remotes improvements
Diffstat (limited to 'tests-clar')
| -rw-r--r-- | tests-clar/network/remotes.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c index f3a45d6ad..beb0bcc8c 100644 --- a/tests-clar/network/remotes.c +++ b/tests-clar/network/remotes.c @@ -36,6 +36,48 @@ void test_network_remotes__refspec_parsing(void) cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/test/*")); } +void test_network_remotes__set_fetchspec(void) +{ + cl_git_pass(git_remote_set_fetchspec(_remote, "refs/*:refs/*")); + _refspec = git_remote_fetchspec(_remote); + cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*")); + cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*")); +} + +void test_network_remotes__set_pushspec(void) +{ + cl_git_pass(git_remote_set_pushspec(_remote, "refs/*:refs/*")); + _refspec = git_remote_pushspec(_remote); + cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*")); + cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*")); +} + +void test_network_remotes__save(void) +{ + git_remote_free(_remote); + + /* Set up the remote and save it to config */ + cl_git_pass(git_remote_new(&_remote, _repo, "git://github.com/libgit2/libgit2", "upstream")); + cl_git_pass(git_remote_set_fetchspec(_remote, "refs/heads/*:refs/remotes/upstream/*")); + cl_git_pass(git_remote_set_pushspec(_remote, "refs/heads/*:refs/heads/*")); + cl_git_pass(git_remote_save(_remote)); + git_remote_free(_remote); + _remote = NULL; + + /* Load it from config and make sure everything matches */ + cl_git_pass(git_remote_load(&_remote, _repo, "upstream")); + + _refspec = git_remote_fetchspec(_remote); + cl_assert(_refspec != NULL); + cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*")); + cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/upstream/*")); + + _refspec = git_remote_pushspec(_remote); + cl_assert(_refspec != NULL); + cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*")); + cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/heads/*")); +} + void test_network_remotes__fnmatch(void) { cl_git_pass(git_refspec_src_match(_refspec, "refs/heads/master")); |
