Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f8d005

Browse files
committed
Merge pull request libgit2#2686 from ethomson/rename_notfound
Propogate GIT_ENOTFOUND from git_remote_rename
2 parents de0c455 + cce27d8 commit 3f8d005

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ int git_remote_rename(git_strarray *out, git_repository *repo, const char *name,
16771677
assert(out && repo && name && new_name);
16781678

16791679
if ((error = git_remote_load(&remote, repo, name)) < 0)
1680-
return -1;
1680+
return error;
16811681

16821682
if ((error = ensure_remote_name_is_valid(new_name)) < 0)
16831683
goto cleanup;

tests/network/remote/rename.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ void test_network_remote_rename__overwrite_ref_in_target(void)
200200
git_branch_iterator_free(iter);
201201
}
202202

203+
void test_network_remote_rename__nonexistent_returns_enotfound(void)
204+
{
205+
git_strarray problems = {0};
206+
207+
int err = git_remote_rename(&problems, _repo, "nonexistent", "renamed");
208+
209+
cl_assert_equal_i(GIT_ENOTFOUND, err);
210+
}
211+
203212
void test_network_remote_rename__symref_head(void)
204213
{
205214
int error;

0 commit comments

Comments
 (0)