diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-26 17:45:33 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-26 17:45:33 +0200 |
commit | 3c7a46978deedd012c8a024eff89b539e044f57d (patch) | |
tree | 2b25e1119d025aa62bea2b4851cbb319aa76d981 /src | |
parent | 14888070b941824b7f6369c60d7600594d215577 (diff) | |
parent | 13e5e344a66ede4274d07ff95dcd241156fc2bdc (diff) | |
download | libgit2-3c7a46978deedd012c8a024eff89b539e044f57d.tar.gz |
Merge pull request #3262 from libgit2/vmg/prefix-len
Desenfuckenate prefix lookups
Diffstat (limited to 'src')
-rw-r--r-- | src/object.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/object.c b/src/object.c index a178e0ed3..1073559fd 100644 --- a/src/object.c +++ b/src/object.c @@ -129,10 +129,10 @@ int git_object_lookup_prefix( if (error < 0) return error; - if (len > GIT_OID_RAWSZ) - len = GIT_OID_RAWSZ; + if (len > GIT_OID_HEXSZ) + len = GIT_OID_HEXSZ; - if (len == GIT_OID_RAWSZ) { + if (len == GIT_OID_HEXSZ) { git_cached_obj *cached = NULL; /* We want to match the full id : we can first look up in the cache, @@ -172,9 +172,9 @@ int git_object_lookup_prefix( memcpy(short_oid.id, id->id, (len + 1) / 2); if (len % 2) short_oid.id[len / 2] &= 0xF0; - memset(short_oid.id + (len + 1) / 2, 0, (GIT_OID_RAWSZ - len) / 2); + memset(short_oid.id + (len + 1) / 2, 0, (GIT_OID_HEXSZ - len) / 2); - /* If len < GIT_OID_RAWSZ (a strict short oid was given), we have + /* If len < GIT_OID_HEXSZ (a strict short oid was given), we have * 2 options : * - We always search in the cache first. If we find that short oid is * ambiguous, we can stop. But in all the other cases, we must then |