gitforgefs/fs/filesystem.go

29 lines
605 B
Go
Raw Normal View History

package fs
import (
"fmt"
2020-12-29 02:37:18 +00:00
"github.com/badjware/gitlabfs/git"
"github.com/badjware/gitlabfs/gitlab"
"github.com/hanwen/go-fuse/v2/fs"
)
2020-12-29 02:37:18 +00:00
func Start(gf gitlab.GroupFetcher, gp git.GitClonerPuller, mountpoint string, rootGrouptID int) error {
fmt.Printf("Mounting in %v\n", mountpoint)
opts := &fs.Options{}
opts.Debug = true
2020-12-29 02:37:18 +00:00
root, err := newRootGroupNode(gf, gp, rootGrouptID)
if err != nil {
2020-12-29 02:37:18 +00:00
return fmt.Errorf("root group fetch fail: %v", err)
}
server, err := fs.Mount(mountpoint, root, opts)
if err != nil {
2020-12-29 02:37:18 +00:00
return fmt.Errorf("mount failed: %v", err)
}
server.Wait()
return nil
}