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

Function InitGoGitRepo

repository/gogit.go:117–136  ·  view source on GitHub ↗

InitGoGitRepo creates a new 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

115// of "~/myrepo" and a namespace of "git-bug", local storage for the
116// GoGitRepo will be configured at "~/myrepo/.git/git-bug".
117func InitGoGitRepo(path, namespace string) (*GoGitRepo, error) {
118 r, err := gogit.PlainInit(path, false)
119 if err != nil {
120 return nil, err
121 }
122
123 k, err := defaultKeyring()
124 if err != nil {
125 return nil, err
126 }
127
128 return &GoGitRepo{
129 r: r,
130 path: filepath.Join(path, ".git"),
131 clocks: make(map[string]lamport.Clock),
132 indexes: make(map[string]Index),
133 keyring: k,
134 localStorage: billyLocalStorage{Filesystem: osfs.New(filepath.Join(path, ".git", namespace))},
135 }, nil
136}
137
138// InitBareGoGitRepo creates a new --bare empty git repo at the given
139// path and with the specified LocalStorage namespace. Given a repository

Callers 1

Example_entityFunction · 0.92

Calls 2

defaultKeyringFunction · 0.85
NewMethod · 0.45

Tested by 1

Example_entityFunction · 0.74