From 6002485582541df9dff3e2c782a014564e22ed07 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 27 Jan 2026 19:05:00 +0100 Subject: hash: Use a hashAlgorithmDetails struct for single source of truth hashAlgorithm's are assumed to be valid; methods on invalid hashAlgorithms will panic from out-of-bounds read when it's not found in hashAlgorithmTable and that's expected and intended. --- refs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'refs.go') diff --git a/refs.go b/refs.go index 372d31fd..6efdf5ec 100644 --- a/refs.go +++ b/refs.go @@ -70,7 +70,7 @@ func (repo *Repository) resolvePackedRef(refname string) (Ref, error) { } sp := bytes.IndexByte(line, ' ') - if sp != repo.hashAlgo.size()*2 { + if sp != repo.hashAlgo.Size()*2 { continue } @@ -428,7 +428,7 @@ func (repo *Repository) ListRefs(pattern string) ([]Ref, error) { } sp := bytes.IndexByte(line, ' ') - if sp != repo.hashAlgo.size()*2 { + if sp != repo.hashAlgo.Size()*2 { lastIdx = -1 continue } -- cgit v1.3.1-10-gc9f91