diff options
Diffstat (limited to 'repository/gogit.go')
-rw-r--r-- | repository/gogit.go | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/repository/gogit.go b/repository/gogit.go index e876629a..46a2cb0a 100644 --- a/repository/gogit.go +++ b/repository/gogit.go @@ -50,11 +50,11 @@ type GoGitRepo struct { localStorage billy.Filesystem } -// OpenGoGitRepo opens an already existing repo at the given path and with -// the specified application name. Given a repository path of "~/myrepo" -// and an application name of "git-bug", local storage for the application -// will be configured at "~/myrepo/.git/git-bug". -func OpenGoGitRepo(path, application string, clockLoaders []ClockLoader) (*GoGitRepo, error) { +// OpenGoGitRepo opens an already existing 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". +func OpenGoGitRepo(path, namespace string, clockLoaders []ClockLoader) (*GoGitRepo, error) { path, err := detectGitPath(path) if err != nil { return nil, err @@ -76,7 +76,7 @@ func OpenGoGitRepo(path, application string, clockLoaders []ClockLoader) (*GoGit clocks: make(map[string]lamport.Clock), indexes: make(map[string]bleve.Index), keyring: k, - localStorage: osfs.New(filepath.Join(path, application)), + localStorage: osfs.New(filepath.Join(path, namespace)), } for _, loader := range clockLoaders { @@ -98,11 +98,11 @@ func OpenGoGitRepo(path, application string, clockLoaders []ClockLoader) (*GoGit return repo, nil } -// InitGoGitRepo creates a new empty git repo at the given path and with -// the specified application name. Given a repository path of "~/myrepo" -// and an application name of "git-bug", local storage for the application -// will be configured at "~/myrepo/.git/git-bug". -func InitGoGitRepo(path, application string) (*GoGitRepo, error) { +// 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". +func InitGoGitRepo(path, namespace string) (*GoGitRepo, error) { r, err := gogit.PlainInit(path, false) if err != nil { return nil, err @@ -119,15 +119,15 @@ func InitGoGitRepo(path, application string) (*GoGitRepo, error) { clocks: make(map[string]lamport.Clock), indexes: make(map[string]bleve.Index), keyring: k, - localStorage: osfs.New(filepath.Join(path, ".git", application)), + localStorage: osfs.New(filepath.Join(path, ".git", namespace)), }, nil } -// InitBareGoGitRepo creates a new --bare empty git repo at the given path -// and with the specified application name. Given a repository path of -// "~/myrepo" and an application name of "git-bug", local storage for the -// application will be configured at "~/myrepo/.git/git-bug". -func InitBareGoGitRepo(path, application string) (*GoGitRepo, error) { +// 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". +func InitBareGoGitRepo(path, namespace string) (*GoGitRepo, error) { r, err := gogit.PlainInit(path, true) if err != nil { return nil, err @@ -144,7 +144,7 @@ func InitBareGoGitRepo(path, application string) (*GoGitRepo, error) { clocks: make(map[string]lamport.Clock), indexes: make(map[string]bleve.Index), keyring: k, - localStorage: osfs.New(filepath.Join(path, application)), + localStorage: osfs.New(filepath.Join(path, namespace)), }, nil } @@ -306,7 +306,7 @@ func (repo *GoGitRepo) GetRemotes() (map[string]string, error) { } // LocalStorage returns a billy.Filesystem giving access to -// $RepoPath/.git/$ApplicationName. +// $RepoPath/.git/$Namespace. func (repo *GoGitRepo) LocalStorage() billy.Filesystem { return repo.localStorage } |