aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/env.go4
-rw-r--r--entity/dag/example_test.go6
-rw-r--r--misc/random_bugs/cmd/main.go4
-rw-r--r--repository/gogit.go38
-rw-r--r--repository/gogit_testing.go4
5 files changed, 28 insertions, 28 deletions
diff --git a/commands/env.go b/commands/env.go
index 52be4225..a6bca7e4 100644
--- a/commands/env.go
+++ b/commands/env.go
@@ -14,7 +14,7 @@ import (
"github.com/MichaelMure/git-bug/util/interrupt"
)
-const gitBugApplicationName = "git-bug"
+const gitBugNamespace = "git-bug"
// Env is the environment of a command
type Env struct {
@@ -56,7 +56,7 @@ func loadRepo(env *Env) func(*cobra.Command, []string) error {
return fmt.Errorf("unable to get the current working directory: %q", err)
}
- env.repo, err = repository.OpenGoGitRepo(cwd, gitBugApplicationName, []repository.ClockLoader{bug.ClockLoader})
+ env.repo, err = repository.OpenGoGitRepo(cwd, gitBugNamespace, []repository.ClockLoader{bug.ClockLoader})
if err == repository.ErrNotARepo {
return fmt.Errorf("%s must be run from within a git repo", rootCommandName)
}
diff --git a/entity/dag/example_test.go b/entity/dag/example_test.go
index 7290b4d4..106e359c 100644
--- a/entity/dag/example_test.go
+++ b/entity/dag/example_test.go
@@ -336,15 +336,15 @@ func Read(repo repository.ClockedRepo, id entity.Id) (*ProjectConfig, error) {
}
func Example_entity() {
- const gitBugApplicationName = "git-bug"
+ const gitBugNamespace = "git-bug"
// Note: this example ignore errors for readability
// Note: variable names get a little confusing as we are simulating both side in the same function
// Let's start by defining two git repository and connecting them as remote
repoRenePath, _ := os.MkdirTemp("", "")
repoIsaacPath, _ := os.MkdirTemp("", "")
- repoRene, _ := repository.InitGoGitRepo(repoRenePath, gitBugApplicationName)
- repoIsaac, _ := repository.InitGoGitRepo(repoIsaacPath, gitBugApplicationName)
+ repoRene, _ := repository.InitGoGitRepo(repoRenePath, gitBugNamespace)
+ repoIsaac, _ := repository.InitGoGitRepo(repoIsaacPath, gitBugNamespace)
_ = repoRene.AddRemote("origin", repoIsaacPath)
_ = repoIsaac.AddRemote("origin", repoRenePath)
diff --git a/misc/random_bugs/cmd/main.go b/misc/random_bugs/cmd/main.go
index b017439e..c3506efb 100644
--- a/misc/random_bugs/cmd/main.go
+++ b/misc/random_bugs/cmd/main.go
@@ -11,7 +11,7 @@ import (
// This program will randomly generate a collection of bugs in the repository
// of the current path
func main() {
- const gitBugApplicationName = "git-bug"
+ const gitBugNamespace = "git-bug"
dir, err := os.Getwd()
if err != nil {
@@ -22,7 +22,7 @@ func main() {
bug.ClockLoader,
}
- repo, err := repository.OpenGoGitRepo(dir, gitBugApplicationName, loaders)
+ repo, err := repository.OpenGoGitRepo(dir, gitBugNamespace, loaders)
if err != nil {
panic(err)
}
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
}
diff --git a/repository/gogit_testing.go b/repository/gogit_testing.go
index f80f62c0..7647c711 100644
--- a/repository/gogit_testing.go
+++ b/repository/gogit_testing.go
@@ -7,7 +7,7 @@ import (
"github.com/99designs/keyring"
)
-const testApplicationName = "git-bug"
+const namespace = "git-bug"
// This is intended for testing only
@@ -25,7 +25,7 @@ func CreateGoGitTestRepo(bare bool) TestedRepo {
creator = InitGoGitRepo
}
- repo, err := creator(dir, testApplicationName)
+ repo, err := creator(dir, namespace)
if err != nil {
log.Fatal(err)
}