Commit 3548fcf5 by nulltoken

refs: propagate EEXISTS upon renaming

parent a75770fe
......@@ -1357,8 +1357,8 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
normalization_flags) < 0)
return -1;
if (reference_can_write(ref->owner, normalized, ref->name, force) < 0)
return -1;
if ((result = reference_can_write(ref->owner, normalized, ref->name, force)) < 0)
return result;
/* Initialize path now so we won't get an allocation failure once
* we actually start removing things. */
......
......@@ -337,3 +337,14 @@ void test_refs_rename__move_up(void)
git_reference_free(ref);
git_reference_free(looked_up_ref);
}
void test_refs_rename__propagate_eexists(void)
{
git_reference *ref;
cl_git_pass(git_reference_lookup(&ref, g_repo, packed_head_name));
cl_assert_equal_i(GIT_EEXISTS, git_reference_rename(ref, packed_test_head_name, 0));
git_reference_free(ref);
}
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