summaryrefslogtreecommitdiff
path: root/src/push.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-04-09 05:03:51 +0400
committerBen Straub <bs@github.com>2013-04-09 05:07:04 +0400
commit1aa21fe3b87a1e601023f49c41fab3ce76c189ac (patch)
treeb25c258e7d360cb9dd7d278094ff12b490a0e61e /src/push.c
parent8480eef7ee0c8e52a8bf3ea12e5626009a966164 (diff)
downloadlibgit2-1aa21fe3b87a1e601023f49c41fab3ce76c189ac.tar.gz
Deprecate git_revparse_single and _rangelike
Diffstat (limited to 'src/push.c')
-rw-r--r--src/push.c23
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)