summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Schreiber <schreiber.arthur@googlemail.com>2014-05-30 19:26:49 +0200
committerArthur Schreiber <schreiber.arthur@googlemail.com>2014-05-30 19:26:49 +0200
commitd723dbed0c46ddb2fb037c63cc13a6131c3824b8 (patch)
tree86e870462a67da3cf605024e1d9f82a53293ccd5 /tests
parent58eea5ebf40b698cbaf028b23ee6157d5eb6582c (diff)
downloadlibgit2-d723dbed0c46ddb2fb037c63cc13a6131c3824b8.tar.gz
Remote: Set an error when a remote cannot be found.
Inside `git_remote_load`, the calls to `get_optional_config` use `giterr_clear` to unset any errors that are set due to missing config keys. If neither a fetch nor a push url config was found for a remote, we should set an error again.
Diffstat (limited to 'tests')
-rw-r--r--tests/network/remote/remotes.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index 306ccaee5..333b52a5b 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -60,6 +60,15 @@ void test_network_remote_remotes__pushurl(void)
cl_assert(git_remote_pushurl(_remote) == NULL);
}
+void test_network_remote_remotes__error_when_not_found(void)
+{
+ git_remote *r;
+ cl_git_fail_with(git_remote_load(&r, _repo, "does-not-exist"), GIT_ENOTFOUND);
+
+ cl_assert(giterr_last() != NULL);
+ cl_assert(giterr_last()->klass == GITERR_CONFIG);
+}
+
void test_network_remote_remotes__error_when_no_push_available(void)
{
git_remote *r;