diff options
| author | 2026-03-25 19:33:32 +0000 | |
|---|---|---|
| committer | 2026-03-25 19:33:57 +0000 | |
| commit | 1aa5cad4c8d6455eeb1f10893549e18bcca11996 (patch) | |
| tree | 31082a30bde08639fc764c52c3cf2283489f3302 /object/fetch/treefs.go | |
| parent | TODO: updates (diff) | |
| signature | No signature | |
object/fetch: Rename from object/resolve
Diffstat (limited to 'object/fetch/treefs.go')
| -rw-r--r-- | object/fetch/treefs.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/object/fetch/treefs.go b/object/fetch/treefs.go new file mode 100644 index 00000000..06b6ad25 --- /dev/null +++ b/object/fetch/treefs.go @@ -0,0 +1,30 @@ +package fetch + +import ( + "io/fs" + + objectid "codeberg.org/lindenii/furgit/object/id" + "codeberg.org/lindenii/furgit/object/tree" +) + +// TreeFS exposes one Git tree as an fs.FS. +// +// TreeFS interprets names using io/fs path rules. Those rules do not match raw +// Git tree entry naming exactly: names are UTF-8, slash-separated, and must be +// valid fs.FS paths. Tree entries that cannot be represented under those rules +// are not addressable through this API. +// +// TreeFS does not take ownership of its Fetcher. +type TreeFS struct { + resolver *Fetcher + rootTree objectid.ObjectID + rootEntry *tree.TreeEntry +} + +var ( + _ fs.FS = (*TreeFS)(nil) + _ fs.ReadFileFS = (*TreeFS)(nil) + _ fs.ReadDirFS = (*TreeFS)(nil) + _ fs.StatFS = (*TreeFS)(nil) + _ fs.SubFS = (*TreeFS)(nil) +) |
