summaryrefslogtreecommitdiff
path: root/src/push.c
diff options
context:
space:
mode:
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)