summaryrefslogtreecommitdiff
path: root/src/revparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/revparse.c')
-rw-r--r--src/revparse.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/revparse.c b/src/revparse.c
index 329b96dbc..05ddc6c35 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -115,12 +115,9 @@ static int revparse_lookup_object(
if (error < 0 && error != GIT_ENOTFOUND)
return error;
- error = maybe_abbrev(object_out, repo, spec);
- if (!error)
- return 0;
-
- if (error < 0 && error != GIT_ENOTFOUND)
- return error;
+ if ((strlen(spec) < GIT_OID_HEXSZ) &&
+ ((error = maybe_abbrev(object_out, repo, spec)) != GIT_ENOTFOUND))
+ return error;
error = maybe_describe(object_out, repo, spec);
if (!error)