aboutsummaryrefslogtreecommitdiff
path: root/object/resolve
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-25 04:55:16 +0000
committerGravatar Runxi Yu2026-03-25 04:55:16 +0000
commitfc430714b9c94d23a22cca4690154e5a49983a35 (patch)
treec7cdc255c4e9036ab8f37bce8cd02dc6ab744fb8 /object/resolve
parentROADMAP: Split from README (diff)
signatureNo signature
object/resolve: I guess document this about path? v0.1.106
Diffstat (limited to 'object/resolve')
-rw-r--r--object/resolve/path.go10
1 files changed, 9 insertions, 1 deletions
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{}