summaryrefslogtreecommitdiff
path: root/src/push.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-04-15 15:47:38 -0700
committerVicent Martí <vicent@github.com>2013-04-15 15:47:38 -0700
commit24f61bc53a9843f86ce79bae92a38e0e4565734b (patch)
tree2cf068e5be081f7a0d1cfeeda948ac4eadead2c0 /src/push.c
parent54e05482348c3844c6002b3a96ab05264cf66993 (diff)
parent32ef1d1c7cc8c603ab78416262cc421b80a8c2df (diff)
downloadlibgit2-24f61bc53a9843f86ce79bae92a38e0e4565734b.tar.gz
Merge pull request #1469 from libgit2/vmg/unified-revision
Unified rev-parse, with a revision object
Diffstat (limited to 'src/push.c')
-rw-r--r--src/push.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/push.c b/src/push.c
index f81a0aee9..cec4c64af 100644
--- a/src/push.c
+++ b/src/push.c
@@ -99,19 +99,17 @@ 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);
+ git_object_free(obj);
- 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);
+ if (!error)
+ return 0;
- return -1;
- } else
- git_object_free(obj);
-
- 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)