diff options
| author | 2026-01-27 19:05:00 +0100 | |
|---|---|---|
| committer | 2026-01-27 19:09:10 +0100 | |
| commit | 6002485582541df9dff3e2c782a014564e22ed07 (patch) | |
| tree | 0eeb6398044053859c2d80b7b8bc2e13d7fc01ac /obj_tree.go | |
| parent | TODO: HashAlgorithm interface? compression agility? (diff) | |
| signature | No signature | |
hash: Use a hashAlgorithmDetails struct for single source of truth v0.1.2
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.
Diffstat (limited to 'obj_tree.go')
| -rw-r--r-- | obj_tree.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/obj_tree.go b/obj_tree.go index 1a63d729..07c77441 100644 --- a/obj_tree.go +++ b/obj_tree.go @@ -78,13 +78,13 @@ func parseTree(id Hash, body []byte, repo *Repository) (*StoredTree, error) { nameBytes := body[i : i+nul] i += nul + 1 - if i+repo.hashAlgo.size() > len(body) { + if i+repo.hashAlgo.Size() > len(body) { return nil, errors.New("furgit: tree: truncated child hash") } var child Hash - copy(child.data[:], body[i:i+repo.hashAlgo.size()]) + copy(child.data[:], body[i:i+repo.hashAlgo.Size()]) child.algo = repo.hashAlgo - i += repo.hashAlgo.size() + i += repo.hashAlgo.Size() mode, err := strconv.ParseUint(string(modeBytes), 8, 32) if err != nil { |
