MCPcopy Create free account
hub / github.com/git-bug/git-bug / InitBareGoGitRepo

Function InitBareGoGitRepo

repository/gogit.go:142–161  ·  view source on GitHub ↗

InitBareGoGitRepo creates a new --bare empty git repo at the given path and with the specified LocalStorage namespace. Given a repository path of "~/myrepo" and a namespace of "git-bug", local storage for the GoGitRepo will be configured at "~/myrepo/.git/git-bug".

(path, namespace string)

Source from the content-addressed store, hash-verified

140// path of "~/myrepo" and a namespace of "git-bug", local storage for the
141// GoGitRepo will be configured at "~/myrepo/.git/git-bug".
142func InitBareGoGitRepo(path, namespace string) (*GoGitRepo, error) {
143 r, err := gogit.PlainInit(path, true)
144 if err != nil {
145 return nil, err
146 }
147
148 k, err := defaultKeyring()
149 if err != nil {
150 return nil, err
151 }
152
153 return &GoGitRepo{
154 r: r,
155 path: path,
156 clocks: make(map[string]lamport.Clock),
157 indexes: make(map[string]Index),
158 keyring: k,
159 localStorage: billyLocalStorage{Filesystem: osfs.New(filepath.Join(path, namespace))},
160 }, nil
161}
162
163func detectGitPath(path string, depth int) (string, error) {
164 if depth >= 10 {

Callers

nothing calls this directly

Calls 2

defaultKeyringFunction · 0.85
NewMethod · 0.45

Tested by

no test coverage detected