I was trying to use go-git for building a filesystem-based git implementation. But I could not find much info from GoDoc nor examples in the project. Things got worse when I went to go-billy package... ( I could only find one example called 'remotes' which deals with git.Init, but memory.NewStorage doesnot need params unfortunately )
From the GoDoc and this issue [#704] (maybe out of date) , I should init a repo by ( I guess... )
fs := osfs.New("path/to/my/repo")
storage, err := filesystem.NewStorage(fs, ??) // What should I pass as a cache.Object ?
repo, err := git.Init(storage, ??) // What should I pass as a worktree
// I also see `repo, err := git.PlainInit("path/to/my/repo", false)` from doc. Will this work?
// I want to commit something to this repo later. So this must not be bare.
Here's my questions:
According to the doc, the second param of filesystem.NewStorage cannot be nil if I want a normal repo (not a bare one because I want to commit something later). So what should I pass?
I can barely find some instructions from go-billy but git.Init need it. Am I using osfs.New currectly?
Similar to Question 1, I do want a normal repo and the second param of git.Init cannot be nil or omitted. What should I use?
I saw git.PlainInit with pretty simple params. Can I use this?
Maybe an example will be the best. I really appreicate your great work at this tool!
I was trying to use go-git for building a filesystem-based git implementation. But I could not find much info from GoDoc nor examples in the project. Things got worse when I went to go-billy package... ( I could only find one example called 'remotes' which deals with
git.Init
, butmemory.NewStorage
doesnot need params unfortunately )From the GoDoc and this issue [#704] (maybe out of date) , I should init a repo by ( I guess... )
Here's my questions:
filesystem.NewStorage
cannot benil
if I want a normal repo (not a bare one because I want to commit something later). So what should I pass?git.Init
need it. Am I usingosfs.New
currectly?git.Init
cannot be nil or omitted. What should I use?git.PlainInit
with pretty simple params. Can I use this?Maybe an example will be the best. I really appreicate your great work at this tool!