From ab7501be34032fb9e5c48726a68ae90a917af9eb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 4 Mar 2026 08:26:56 +0800 Subject: *: Lint --- object/tree_parse.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'object/tree_parse.go') diff --git a/object/tree_parse.go b/object/tree_parse.go index 37a2fa4b..dd4faa8b 100644 --- a/object/tree_parse.go +++ b/object/tree_parse.go @@ -11,12 +11,14 @@ import ( // ParseTree decodes a tree object body. func ParseTree(body []byte, algo objectid.Algorithm) (*Tree, error) { var entries []TreeEntry + i := 0 for i < len(body) { space := bytes.IndexByte(body[i:], ' ') if space < 0 { return nil, fmt.Errorf("object: tree: missing mode terminator") } + modeBytes := body[i : i+space] i += space + 1 @@ -24,6 +26,7 @@ func ParseTree(body []byte, algo objectid.Algorithm) (*Tree, error) { if nul < 0 { return nil, fmt.Errorf("object: tree: missing name terminator") } + nameBytes := body[i : i+nul] i += nul + 1 @@ -31,10 +34,12 @@ func ParseTree(body []byte, algo objectid.Algorithm) (*Tree, error) { if idEnd > len(body) { return nil, fmt.Errorf("object: tree: truncated child object id") } + id, err := objectid.FromBytes(algo, body[i:idEnd]) if err != nil { return nil, err } + i = idEnd mode, err := strconv.ParseUint(string(modeBytes), 8, 32) -- cgit v1.3.1-10-gc9f91