aboutsummaryrefslogtreecommitdiff
path: root/refs.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-16 00:00:00 +0000
committerGravatar Runxi Yu2025-11-16 00:00:00 +0000
commit9ac827977b8f430906110ecd2030324248fff604 (patch)
treeb0f8fdb46252bef429beb27190a2cfc0cbd42540 /refs.go
parentREADME: Add my Villosa instance (diff)
signature
Support multiple hash sizes in one build
Diffstat (limited to 'refs.go')
-rw-r--r--refs.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/refs.go b/refs.go
index df3a8303..b543a842 100644
--- a/refs.go
+++ b/refs.go
@@ -29,7 +29,7 @@ func (repo *Repository) resolveLooseRef(refname string) (Hash, error) {
return Hash{}, err
}
line := strings.TrimSpace(string(data))
- id, err := ParseHash(line)
+ id, err := ParseHashWithSize(line, repo.HashSize)
if err != nil {
return Hash{}, err
}
@@ -55,13 +55,13 @@ func (repo *Repository) resolvePackedRef(refname string) (Hash, error) {
continue
}
sp := bytes.IndexByte(line, ' ')
- if sp != HashSize*2 {
+ if sp != repo.HashSize*2 {
continue
}
name := line[sp+1:]
if bytes.Equal(name, want) {
hex := string(line[:sp])
- id, err := ParseHash(hex)
+ id, err := ParseHashWithSize(hex, repo.HashSize)
if err != nil {
return Hash{}, err
}