diff options
| author | 2026-01-17 22:56:53 +0800 | |
|---|---|---|
| committer | 2026-01-17 22:56:53 +0800 | |
| commit | 7a0ab5f77917a36a87945f6a88b036b9b6ba88ee (patch) | |
| tree | 06947107af26e45bb5006276daa4b4d611f5dee2 /loose.go | |
| parent | README: Clarify that the sha1 build tag is for testing only (diff) | |
| signature | No signature | |
hash: Key by algorithm, not size
Diffstat (limited to 'loose.go')
| -rw-r--r-- | loose.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 |
