From 435be2b693aee89ed34a2d1e7291b3b141b19717 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 6 Aug 2018 20:31:20 +0200 Subject: bug: add a Lamport logical clock to be able to sort bugs by creation time and edit time without having to rely on a timestamp --- commands/root.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'commands') 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 -- cgit