diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-21 18:18:51 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-21 18:53:37 +0200 |
commit | 82eaceffc1d750832a2a66f206749d2dca968cce (patch) | |
tree | 1431c8f1fd9baa689b850da7f104d12c20b1d8a7 /commands | |
parent | 6a575fbf483e2b28821908f67e87637d9e5cea75 (diff) | |
download | git-bug-82eaceffc1d750832a2a66f206749d2dca968cce.tar.gz |
repo: split the Repo interface to avoid abstraction leak in RepoCache
Diffstat (limited to 'commands')
-rw-r--r-- | commands/add.go | 2 | ||||
-rw-r--r-- | commands/comment_add.go | 2 | ||||
-rw-r--r-- | commands/root.go | 2 | ||||
-rw-r--r-- | commands/select/select.go | 8 |
4 files changed, 7 insertions, 7 deletions
diff --git a/commands/add.go b/commands/add.go index 3fa75f26..944f0a99 100644 --- a/commands/add.go +++ b/commands/add.go @@ -31,7 +31,7 @@ func runAddBug(cmd *cobra.Command, args []string) error { defer backend.Close() if addMessage == "" || addTitle == "" { - addTitle, addMessage, err = input.BugCreateEditorInput(backend.Repository(), addTitle, addMessage) + addTitle, addMessage, err = input.BugCreateEditorInput(backend, addTitle, addMessage) if err == input.ErrEmptyTitle { fmt.Println("Empty title, aborting.") diff --git a/commands/comment_add.go b/commands/comment_add.go index 8898ea45..0a83eb65 100644 --- a/commands/comment_add.go +++ b/commands/comment_add.go @@ -29,7 +29,7 @@ func runCommentAdd(cmd *cobra.Command, args []string) error { } if commentAddMessage == "" { - commentAddMessage, err = input.BugCommentEditorInput(backend.Repository()) + commentAddMessage, err = input.BugCommentEditorInput(backend) if err == input.ErrEmptyMessage { fmt.Println("Empty message, aborting.") return nil diff --git a/commands/root.go b/commands/root.go index 298fb427..ebf688dc 100644 --- a/commands/root.go +++ b/commands/root.go @@ -13,7 +13,7 @@ import ( const rootCommandName = "git-bug" // package scoped var to hold the repo after the PreRun execution -var repo repository.Repo +var repo repository.ClockedRepo // RootCmd represents the base command when called without any subcommands var RootCmd = &cobra.Command{ diff --git a/commands/select/select.go b/commands/select/select.go index 5d6cee7f..203a2f1e 100644 --- a/commands/select/select.go +++ b/commands/select/select.go @@ -55,7 +55,7 @@ func ResolveBug(repo *cache.RepoCache, args []string) (*cache.BugCache, []string // Select will select a bug for future use func Select(repo *cache.RepoCache, id string) error { - selectPath := selectFilePath(repo.Repository()) + selectPath := selectFilePath(repo) f, err := os.OpenFile(selectPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) if err != nil { @@ -72,13 +72,13 @@ func Select(repo *cache.RepoCache, id string) error { // Clear will clear the selected bug, if any func Clear(repo *cache.RepoCache) error { - selectPath := selectFilePath(repo.Repository()) + selectPath := selectFilePath(repo) return os.Remove(selectPath) } func selected(repo *cache.RepoCache) (*cache.BugCache, error) { - selectPath := selectFilePath(repo.Repository()) + selectPath := selectFilePath(repo) f, err := os.Open(selectPath) if err != nil { @@ -120,6 +120,6 @@ func selected(repo *cache.RepoCache) (*cache.BugCache, error) { return b, nil } -func selectFilePath(repo repository.Repo) string { +func selectFilePath(repo repository.RepoCommon) string { return path.Join(repo.GetPath(), ".git", "git-bug", selectFile) } |