diff options
author | Paulo Gomes <paulo.gomes@suse.com> | 2023-12-02 10:30:30 +0000 |
---|---|---|
committer | Paulo Gomes <paulo.gomes@suse.com> | 2023-12-02 10:30:39 +0000 |
commit | 8b47ceb1aa854f3c3bfa1c347157a04324fcd51e (patch) | |
tree | 4bb09922af1faa0caca922f0e22f5ba341c970e2 /storage/filesystem/storage.go | |
parent | 4f614891047bae5d0f7a253f014175505b9821d7 (diff) | |
download | go-git-8b47ceb1aa854f3c3bfa1c347157a04324fcd51e.tar.gz |
storage: filesystem, Add option to set a specific FS for alternates
Introduces the option to set a FS for alternates, enabling more flexible cross FS
sharing of alternates. If none is set, falls back to the current FS used for the
object storage.
The changes only process a given path once, and if an alternates dir is not valid,
exits with error - aligning behaviour with upstream.
Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
Diffstat (limited to 'storage/filesystem/storage.go')
-rw-r--r-- | storage/filesystem/storage.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go index 2069d3a..951ea00 100644 --- a/storage/filesystem/storage.go +++ b/storage/filesystem/storage.go @@ -37,6 +37,10 @@ type Options struct { // LargeObjectThreshold maximum object size (in bytes) that will be read in to memory. // If left unset or set to 0 there is no limit LargeObjectThreshold int64 + // AlternatesFS provides the billy filesystem to be used for Git Alternates. + // If none is provided, it falls back to using the underlying instance used for + // DotGit. + AlternatesFS billy.Filesystem } // NewStorage returns a new Storage backed by a given `fs.Filesystem` and cache. @@ -49,6 +53,7 @@ func NewStorage(fs billy.Filesystem, cache cache.Object) *Storage { func NewStorageWithOptions(fs billy.Filesystem, cache cache.Object, ops Options) *Storage { dirOps := dotgit.Options{ ExclusiveAccess: ops.ExclusiveAccess, + AlternatesFS: ops.AlternatesFS, } dir := dotgit.NewWithOptions(fs, dirOps) |