diff options
Diffstat (limited to 'src/push.c')
-rw-r--r-- | src/push.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/push.c b/src/push.c index 37f641812..dcd8122d1 100644 --- a/src/push.c +++ b/src/push.c @@ -96,21 +96,18 @@ static int check_rref(char *ref) static int check_lref(git_push *push, char *ref) { /* lref must be resolvable to an existing object */ - git_object *obj; - int error = git_revparse_single(&obj, push->repo, ref); - - if (error) { - if (error == GIT_ENOTFOUND) - giterr_set(GITERR_REFERENCE, - "src refspec '%s' does not match any existing object", ref); - else - giterr_set(GITERR_INVALID, "Not a valid reference '%s'", ref); + git_oid oid; + int error = git_revparse(&oid, NULL, NULL, push->repo, ref); - return -1; - } else - git_object_free(obj); + if (!error) + return 0; - return 0; + if (error == GIT_ENOTFOUND) + giterr_set(GITERR_REFERENCE, + "src refspec '%s' does not match any existing object", ref); + else + giterr_set(GITERR_INVALID, "Not a valid reference '%s'", ref); + return -1; } static int parse_refspec(git_push *push, push_spec **spec, const char *str) |