diff options
author | Ben Straub <bs@github.com> | 2012-08-23 12:29:09 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2012-08-25 09:56:20 -0700 |
commit | c9de8611d6a3e77757a714cdf6acf46178b1d622 (patch) | |
tree | f0129e6c85be71c6241bd00dcf6305115d2bb4a4 | |
parent | 5fdc41e76591aebdbae3b49440bc2c8b2430718c (diff) | |
download | libgit2-c9de8611d6a3e77757a714cdf6acf46178b1d622.tar.gz |
Revparse: GIT_EAMBIGUOUS
Revparse now returns EAMBIGUOUS if the the spec
doesn't match any refs/tags, and is <4 characters.
-rw-r--r-- | src/oid.c | 3 | ||||
-rw-r--r-- | tests-clar/refs/revparse.c | 9 |
2 files changed, 9 insertions, 3 deletions
@@ -24,9 +24,6 @@ int git_oid_fromstrn(git_oid *out, const char *str, size_t length) size_t p; int v; - if (length < 4) - return oid_error_invalid("input too short"); - if (length > GIT_OID_HEXSZ) length = GIT_OID_HEXSZ; diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c index 02acb884..14bd9fb8 100644 --- a/tests-clar/refs/revparse.c +++ b/tests-clar/refs/revparse.c @@ -442,3 +442,12 @@ void test_refs_revparse__disambiguation(void) */ test_object("e90810", "e90810b8df3e80c413d903f631643c716887138d"); } + +void test_refs_revparse__a_too_short_objectid_returns_EAMBIGUOUS(void) +{ + int result; + + result = git_revparse_single(&g_obj, g_repo, "e90"); + + cl_assert_equal_i(GIT_EAMBIGUOUS, result); +} |