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)
| 115 | // of "~/myrepo" and a namespace of "git-bug", local storage for the |
| 116 | // GoGitRepo will be configured at "~/myrepo/.git/git-bug". |
| 117 | func 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 |