Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

object/fetch: Use the new path splitting API

Runxi Yu f82bdff5 22f7dcbf

+2 -20
+1 -1
object/fetch/treefs_entry.go
··· 23 23 }, nil 24 24 } 25 25 26 - entry, err := treeFS.fetcher.Path(treeFS.rootTree, treeFSSplitPath(name)) 26 + entry, err := treeFS.fetcher.Path(treeFS.rootTree, tree.SplitPath([]byte(name))) 27 27 if err != nil { 28 28 return treeEntryValue{}, treeFS.pathResolveError(op, name, err) 29 29 }
+1 -19
object/fetch/treefs_path.go
··· 1 1 package fetch 2 2 3 - import ( 4 - "io/fs" 5 - "strings" 6 - ) 3 + import "io/fs" 7 4 8 5 func treeFSValidPath(name string) bool { 9 6 return name == "." || fs.ValidPath(name) 10 - } 11 - 12 - func treeFSSplitPath(name string) [][]byte { 13 - if name == "." { 14 - return nil 15 - } 16 - 17 - parts := strings.Split(name, "/") 18 - 19 - out := make([][]byte, len(parts)) 20 - for i, part := range parts { 21 - out[i] = []byte(part) 22 - } 23 - 24 - return out 25 7 } 26 8 27 9 func treeFSPathError(op treeFSOp, path string, err error) error {