mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-04 20:45:07 +00:00
refs: propagate EEXISTS upon renaming
This commit is contained in:
parent
a75770febc
commit
3548fcf562
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user