Commit 3f8d005a by Carlos Martín Nieto

Merge pull request #2686 from ethomson/rename_notfound

Propogate GIT_ENOTFOUND from git_remote_rename
parents de0c4555 cce27d82
......@@ -1677,7 +1677,7 @@ int git_remote_rename(git_strarray *out, git_repository *repo, const char *name,
assert(out && repo && name && new_name);
if ((error = git_remote_load(&remote, repo, name)) < 0)
return -1;
return error;
if ((error = ensure_remote_name_is_valid(new_name)) < 0)
goto cleanup;
......
......@@ -200,6 +200,15 @@ void test_network_remote_rename__overwrite_ref_in_target(void)
git_branch_iterator_free(iter);
}
void test_network_remote_rename__nonexistent_returns_enotfound(void)
{
git_strarray problems = {0};
int err = git_remote_rename(&problems, _repo, "nonexistent", "renamed");
cl_assert_equal_i(GIT_ENOTFOUND, err);
}
void test_network_remote_rename__symref_head(void)
{
int error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment