diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/root.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/commands/root.go b/commands/root.go index cee39083..be258199 100644 --- a/commands/root.go +++ b/commands/root.go @@ -2,6 +2,7 @@ package commands import ( "fmt" + "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/repository" "github.com/spf13/cobra" "os" @@ -49,10 +50,13 @@ func loadRepo(cmd *cobra.Command, args []string) error { return fmt.Errorf("Unable to get the current working directory: %q\n", err) } - repo, err = repository.NewGitRepo(cwd) - if err != nil { + repo, err = repository.NewGitRepo(cwd, bug.Witnesser) + if err == repository.ErrNotARepo { return fmt.Errorf("%s must be run from within a git repo.\n", rootCommandName) + } + if err != nil { + return err } return nil |