aboutsummaryrefslogtreecommitdiffstats
path: root/bug/bug_actions.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-09-16 16:22:02 +0200
committerMichael Muré <batolettre@gmail.com>2020-10-04 20:39:10 +0200
commitca720f165cb286d4372ad48595e532a2423f2f07 (patch)
tree6e1496a1a6603abbd473cc0060a5acebc763a68b /bug/bug_actions.go
parentd56ce3d5d9f5ef74201a8ee7c25be4820d435b47 (diff)
downloadgit-bug-ca720f165cb286d4372ad48595e532a2423f2f07.tar.gz
cache,bug,identity: structural change
- bug doesn't commit identities anymore, only make sure they are commit - cache use an IdentityResolver to load bugs with identities from the cache (deps injection) - IdentityCache now are identity.Interface
Diffstat (limited to 'bug/bug_actions.go')
-rw-r--r--bug/bug_actions.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/bug/bug_actions.go b/bug/bug_actions.go
index f99f83ad..21ce3733 100644
--- a/bug/bug_actions.go
+++ b/bug/bug_actions.go
@@ -5,6 +5,7 @@ import (
"strings"
"github.com/MichaelMure/git-bug/entity"
+ "github.com/MichaelMure/git-bug/identity"
"github.com/MichaelMure/git-bug/repository"
"github.com/pkg/errors"
)
@@ -57,6 +58,11 @@ func Pull(repo repository.ClockedRepo, remote string) error {
func MergeAll(repo repository.ClockedRepo, remote string) <-chan entity.MergeResult {
out := make(chan entity.MergeResult)
+ // no caching for the merge, we load everything from git even if that means multiple
+ // copy of the same entity in memory. The cache layer will intercept the results to
+ // invalidate entities if necessary.
+ identityResolver := identity.NewSimpleResolver(repo)
+
go func() {
defer close(out)
@@ -77,7 +83,7 @@ func MergeAll(repo repository.ClockedRepo, remote string) <-chan entity.MergeRes
continue
}
- remoteBug, err := readBug(repo, remoteRef)
+ remoteBug, err := read(repo, identityResolver, remoteRef)
if err != nil {
out <- entity.NewMergeInvalidStatus(id, errors.Wrap(err, "remote bug is not readable").Error())
@@ -111,7 +117,7 @@ func MergeAll(repo repository.ClockedRepo, remote string) <-chan entity.MergeRes
continue
}
- localBug, err := readBug(repo, localRef)
+ localBug, err := read(repo, identityResolver, localRef)
if err != nil {
out <- entity.NewMergeError(errors.Wrap(err, "local bug is not readable"), id)