summaryrefslogtreecommitdiff
path: root/src/libgit2/push.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libgit2/push.c')
-rw-r--r--src/libgit2/push.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libgit2/push.c b/src/libgit2/push.c
index d477b4f0d..e25681870 100644
--- a/src/libgit2/push.c
+++ b/src/libgit2/push.c
@@ -385,11 +385,18 @@ static int calculate_work(git_push *push)
git_vector_foreach(&push->specs, i, spec) {
if (spec->refspec.src && spec->refspec.src[0]!= '\0') {
/* This is a create or update. Local ref must exist. */
- if (git_reference_name_to_id(
- &spec->loid, push->repo, spec->refspec.src) < 0) {
- git_error_set(GIT_ERROR_REFERENCE, "no such reference '%s'", spec->refspec.src);
+
+ git_object *obj;
+ int error = git_revparse_single(&obj, push->repo, spec->refspec.src);
+
+ if (error < 0) {
+ git_object_free(obj);
+ git_error_set(GIT_ERROR_REFERENCE, "src refspec %s does not match any", spec->refspec.src);
return -1;
}
+
+ git_oid_cpy(&spec->loid, git_object_id(obj));
+ git_object_free(obj);
}
/* Remote ref may or may not (e.g. during create) already exist. */