mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 20:42:23 +00:00
rename: don't return early if the target ref exists
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
This commit is contained in:
parent
591a9423f5
commit
dad4a4d582
@ -1050,12 +1050,14 @@ int git_reference_rename_internal(git_reference *ref, const char *new_name, int
|
|||||||
if (error < GIT_SUCCESS)
|
if (error < GIT_SUCCESS)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
/* Ensure we're not going to overwrite an existing reference */
|
/* Ensure we're not going to overwrite an existing reference
|
||||||
|
unless the user has allowed us */
|
||||||
error = git_reference_lookup(&looked_up_ref, ref->owner, new_name);
|
error = git_reference_lookup(&looked_up_ref, ref->owner, new_name);
|
||||||
if (error == GIT_SUCCESS && !force)
|
if (error == GIT_SUCCESS && !force)
|
||||||
return GIT_EEXISTS;
|
return GIT_EEXISTS;
|
||||||
|
|
||||||
if (error != GIT_ENOTFOUND)
|
if (error < GIT_SUCCESS &&
|
||||||
|
error != GIT_ENOTFOUND)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user