Commit 76b15cb1 by schu

Raise GIT_EEXISTS in case of conflicting ref names instead of passing

the error returned by the subsystem; clarify error message.

Fix tiny typo.

Signed-off-by: schu <schu-github@schulog.org>
parent 1b6d8163
......@@ -1084,7 +1084,7 @@ static int reference_available(git_repository *repo, const char *ref, const char
git_vector_free(&refs);
return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Reference `%s` already exists", ref);
return error == GIT_SUCCESS ? GIT_SUCCESS : git__throw(GIT_EEXISTS, "Reference name `%s` conflicts with existing reference", ref);
}
/*
......@@ -1124,7 +1124,7 @@ static int reference_rename(git_reference *ref, const char *new_name, int force)
error != GIT_ENOTFOUND)
return git__rethrow(error, "Failed to rename reference");
if ((error == reference_available(ref->owner, new_name, ref->name)) < GIT_SUCCESS)
if ((error = reference_available(ref->owner, new_name, ref->name)) < GIT_SUCCESS)
return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to rename reference. Reference already exists");
old_name = ref->name;
......
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