feat(oid): expand short sha by looking up in ODB

This commit is contained in:
Aleksey Kulikov 2021-08-25 19:25:05 +03:00
parent 747996b40c
commit 3bbcca3c75
6 changed files with 50 additions and 22 deletions

View file

@ -122,9 +122,8 @@ class Repository {
if (target.length == 40) {
oid = Oid.fromSHA(target);
} else {
final shortOid = Oid.fromSHAn(target);
final odb = this.odb;
oid = Oid(odb.existsPrefix(shortOid.pointer, target.length));
oid = Oid.fromShortSHA(target, odb);
odb.free();
}
bindings.setHeadDetached(_repoPointer, oid.pointer);
@ -328,9 +327,8 @@ class Repository {
if (sha.length == 40) {
oid = Oid.fromSHA(sha);
} else {
final shortOid = Oid.fromSHAn(sha);
final odb = this.odb;
oid = Oid(odb.existsPrefix(shortOid.pointer, sha.length));
oid = Oid.fromShortSHA(sha, odb);
odb.free();
}
return oid;