Skip to content

Commit

Permalink
git/gogit: Replaces fs with upstream osfs.BoundOS
Browse files Browse the repository at this point in the history
Deprecates the fs implementation in favour of the upstream osfs.BoundOS.
Both implementations are largely the same, but the upstream had to be
slightly modified API in order to keep backwards compatibility to the rest
of its users.

Signed-off-by: Paulo Gomes <[email protected]>
  • Loading branch information
pjbgf committed Sep 12, 2023
1 parent 01981ea commit 8db6422
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 2,121 deletions.
6 changes: 3 additions & 3 deletions git/gogit/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

"github.com/go-git/go-billy/v5"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-billy/v5/osfs"
extgogit "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
Expand All @@ -39,7 +40,6 @@ import (
"github.com/go-git/go-git/v5/storage/memory"

"github.com/fluxcd/pkg/git"
"github.com/fluxcd/pkg/git/gogit/fs"
"github.com/fluxcd/pkg/git/repository"
)

Expand Down Expand Up @@ -159,8 +159,8 @@ func WithSingleBranch(singleBranch bool) ClientOption {
// Git related objects on disk.
func WithDiskStorage() ClientOption {
return func(c *Client) error {
wt := fs.New(c.path)
dot := fs.New(filepath.Join(c.path, extgogit.GitDirName))
wt := osfs.New(c.path, osfs.WithBoundOS())
dot := osfs.New(filepath.Join(c.path, extgogit.GitDirName), osfs.WithBoundOS())

c.storer = filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
c.worktreeFS = wt
Expand Down
4 changes: 2 additions & 2 deletions git/gogit/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (

"github.com/elazarl/goproxy"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-billy/v5/osfs"
extgogit "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
Expand All @@ -46,7 +47,6 @@ import (

"github.com/fluxcd/gitkit"
"github.com/fluxcd/pkg/git"
"github.com/fluxcd/pkg/git/gogit/fs"
"github.com/fluxcd/pkg/git/repository"
"github.com/fluxcd/pkg/gittestserver"
"github.com/fluxcd/pkg/ssh"
Expand Down Expand Up @@ -1556,7 +1556,7 @@ func Fuzz_GoGitError(f *testing.F) {
}

func initRepo(tmpDir string) (*extgogit.Repository, string, error) {
sto := filesystem.NewStorage(fs.New(tmpDir), cache.NewObjectLRUDefault())
sto := filesystem.NewStorage(osfs.New(tmpDir, osfs.WithBoundOS()), cache.NewObjectLRUDefault())
repo, err := extgogit.Init(sto, memfs.New())
if err != nil {
return nil, "", err
Expand Down
155 changes: 0 additions & 155 deletions git/gogit/fs/join.go

This file was deleted.

Loading

0 comments on commit 8db6422

Please sign in to comment.