From c9009b52990d86c6d2589b786b6545488e8ae6ef Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Thu, 29 Dec 2022 10:26:47 +0100 Subject: commands: don't double build the lamport clocks --- commands/execenv/env.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'commands/execenv/env.go') diff --git a/commands/execenv/env.go b/commands/execenv/env.go index 9b71a45a..b383dde0 100644 --- a/commands/execenv/env.go +++ b/commands/execenv/env.go @@ -8,7 +8,6 @@ import ( "github.com/spf13/cobra" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/entities/bug" "github.com/MichaelMure/git-bug/entities/identity" "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/interrupt" @@ -87,11 +86,13 @@ 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, gitBugNamespace, []repository.ClockLoader{bug.ClockLoader}) + // Note: we are not loading clocks here because we assume that LoadRepo is only used + // when we don't manipulate entities, or as a child call of LoadBackend which will + // read all clocks anyway. + env.Repo, err = repository.OpenGoGitRepo(cwd, gitBugNamespace, nil) if err == repository.ErrNotARepo { return fmt.Errorf("%s must be run from within a git Repo", RootCommandName) } - if err != nil { return err } -- cgit