mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 20:42:23 +00:00
Merge pull request #2389 from arthurschreiber/arthur/set-error-when-no-remote-found
Remote: Set an error when a remote cannot be found.
This commit is contained in:
commit
bccb36ebf9
@ -403,6 +403,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
|
||||
|
||||
if (!optional_setting_found) {
|
||||
error = GIT_ENOTFOUND;
|
||||
giterr_set(GITERR_CONFIG, "Remote '%s' does not exist.", name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user