From fc430714b9c94d23a22cca4690154e5a49983a35 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 25 Mar 2026 04:55:16 +0000 Subject: object/resolve: I guess document this about path? --- object/resolve/path.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/object/resolve/path.go b/object/resolve/path.go index 347c1234..a522d823 100644 --- a/object/resolve/path.go +++ b/object/resolve/path.go @@ -50,7 +50,15 @@ func (err *PathNotTreeError) Error() string { // // parts must contain at least one path segment. Intermediate path segments // must resolve to tree entries. The final entry is returned without loading -// its object. +// its object. Path segments may not contain \x00. +// +// The path cannot be accurately represented as a string or a single []byte +// because Git tree entry names may include slashes. While []string is +// technically possible (since Go strings are not necessarily UTF-8), they +// do often imply UTF-8 in practice, which would be undesirable. +// +// If your entry names are valid UTF-8 and uses / solely as segment separators, +// it may be convenient to use TreeFS for an io/fs.FS-like interface. func (r *Resolver) Path(root objectid.ObjectID, parts [][]byte) (object.TreeEntry, error) { if len(parts) == 0 { return object.TreeEntry{}, &PathEmptyError{} -- cgit v1.3.1-10-gc9f91