aboutsummaryrefslogtreecommitdiff
path: root/loose.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-01-17 22:56:53 +0800
committerGravatar Runxi Yu2026-01-17 22:56:53 +0800
commit7a0ab5f77917a36a87945f6a88b036b9b6ba88ee (patch)
tree06947107af26e45bb5006276daa4b4d611f5dee2 /loose.go
parentREADME: Clarify that the sha1 build tag is for testing only (diff)
signatureNo signature
hash: Key by algorithm, not size
Diffstat (limited to 'loose.go')
-rw-r--r--loose.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/loose.go b/loose.go
index 137f0c41..5932f92f 100644
--- a/loose.go
+++ b/loose.go
@@ -17,8 +17,8 @@ const looseHeaderLimit = 4096
// loosePath returns the path for a loose object, validating hash size.
func (repo *Repository) loosePath(id Hash) (string, error) {
- if id.size != repo.hashSize {
- return "", fmt.Errorf("furgit: hash size mismatch: got %d, expected %d", id.size, repo.hashSize)
+ if id.algo != repo.hashAlgo {
+ return "", fmt.Errorf("furgit: hash algorithm mismatch: got %s, expected %s", id.algo.String(), repo.hashAlgo.String())
}
hex := id.String()
return filepath.Join("objects", hex[:2], hex[2:]), nil