Commit dad4a4d5 by Carlos Martín Nieto Committed by Vicent Marti

rename: don't return early if the target ref exists

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
parent 591a9423
......@@ -1050,12 +1050,14 @@ int git_reference_rename_internal(git_reference *ref, const char *new_name, int
if (error < GIT_SUCCESS)
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);
if (error == GIT_SUCCESS && !force)
return GIT_EEXISTS;
if (error != GIT_ENOTFOUND)
if (error < GIT_SUCCESS &&
error != GIT_ENOTFOUND)
return 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