diff options
| author | 2026-01-17 23:00:14 +0800 | |
|---|---|---|
| committer | 2026-01-17 23:00:14 +0800 | |
| commit | 90b5f779080272d5c6ef39e0c93d8592840a53b7 (patch) | |
| tree | a954e45ec18d8a8dac49c8a3a60eae19a4c4f65e /pack_idx.go | |
| parent | hash: Key by algorithm, not size (diff) | |
| signature | No signature | |
repo: Drop hashSize and use hashAlgo.size()
Diffstat (limited to 'pack_idx.go')
| -rw-r--r-- | pack_idx.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pack_idx.go b/pack_idx.go index d84bb5ec..c4c166ef 100644 --- a/pack_idx.go +++ b/pack_idx.go @@ -163,7 +163,7 @@ func (pi *packIndex) parse(buf []byte) error { nobj := int(readBE32(pi.fanout[len(pi.fanout)-4:])) namesStart := fanoutEnd - namesEnd := namesStart + nobj*pi.repo.hashSize + namesEnd := namesStart + nobj*pi.repo.hashAlgo.size() if namesEnd > len(buf) { return ErrInvalidObject } @@ -183,7 +183,7 @@ func (pi *packIndex) parse(buf []byte) error { pi.offset32 = buf[off32Start:off32End] off64Start := off32End - trailerStart := len(buf) - 2*pi.repo.hashSize + trailerStart := len(buf) - 2*pi.repo.hashAlgo.size() if trailerStart < off64Start { return ErrInvalidObject } @@ -253,7 +253,7 @@ func (pi *packIndex) lookup(id Hash) (packlocation, error) { lo = int(pi.fanoutEntry(first - 1)) } hi := int(pi.fanoutEntry(first)) - idx, found := bsearchHash(pi.names, pi.repo.hashSize, lo, hi, id) + idx, found := bsearchHash(pi.names, pi.repo.hashAlgo.size(), lo, hi, id) if !found { return packlocation{}, ErrNotFound } |
