Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thediveo/gitrepofs
A Go fs.FS git repository file system to easily access a repository at a specific tag (or other git reference).
https://github.com/thediveo/gitrepofs
Last synced: about 1 month ago
JSON representation
A Go fs.FS git repository file system to easily access a repository at a specific tag (or other git reference).
- Host: GitHub
- URL: https://github.com/thediveo/gitrepofs
- Owner: thediveo
- License: apache-2.0
- Created: 2023-01-30T13:14:30.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-15T20:23:37.000Z (10 months ago)
- Last Synced: 2024-05-16T14:01:50.286Z (6 months ago)
- Language: Go
- Size: 53.7 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gitrepofs
[![PkgGoDev](https://img.shields.io/badge/-reference-blue?logo=go&logoColor=white&labelColor=505050)](https://pkg.go.dev/github.com/thediveo/gitrepofs)
[![GitHub](https://img.shields.io/github/license/thediveo/gitrepofs)](https://img.shields.io/github/license/thediveo/gitrepofs)
![build and test](https://github.com/thediveo/gitrepofs/workflows/build%20and%20test/badge.svg?branch=master)
![Coverage](https://img.shields.io/badge/Coverage-93.9%25-brightgreen)
[![Go Report Card](https://goreportcard.com/badge/github.com/thediveo/gitrepofs)](https://goreportcard.com/report/github.com/thediveo/gitrepofs)A Go [fs.FS](https://pkg.go.dev/io/fs#FS) _git repository file system_ to easily
access a repository at a specific tag (or other git reference).The main envisioned use case is for `go generate`-based updates from upstream
repositories to fetch the latest C definitions without the need to integrate
upstream C libraries.```golang
remoteURL := "https://gohub.org/froozle/baduzle"
latest, latestref, err := version.LatestReleaseTag(context.Background(),
remoteURL, version.SemverMatcher)
gfs, err := NewForRevision(context.Background(), remoteURL, latestref)
contents, err := fs.ReadFile(gfs, "some/useful/file.h")
```## Other Implementations
- [@hairyhenderson/go-fsimpl](https://github.com/hairyhenderson/go-fsimpl)
includes a git file system implementation (beside others). It uses the neat
trick of cloning a repository into a local work tree in memory (instead of on
"disk") and then serves from this memory-based file system. This design
requires files to be present twice: once in the in-memory cloned repository
and another time in the memory-based file system. Actively maintained at the
time of this writing, as well as equiped with lots of unit tests.- [@ear7h/go-git-fs](https://github.com/ear7h/go-git-fs) serves directly from an
in-memory git repository clone without a work tree. It doesn't come with any
unit tests and hasn't been maintained since May 2021. The code does the
[fs.ValidPath](https://pkg.go.dev/io/fs#ValidPath) checks but then adds an
unnecessary [path.Clean](https://pkg.go.dev/path#Clean) because `fs.ValidPath`
blocks all the things that `path.Clean` is supposed to sanitize.- out of competition: [@posener/gitfs](https://github.com/posener/gitfs) tackles
[http.FileSystem](https://pkg.go.dev/net/http#FileSystem) instead.## Supported Go Versions
`gitrepofs` supports versions of Go that are noted by the Go release policy,
that is, major versions _N_ and _N_-1 (where _N_ is the current major version).## Copyright and License
`gitrepofs` is Copyright 2023 Harald Albrecht, and licensed under the Apache
License, Version 2.0.