aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-02-14 12:38:09 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:38:09 +0100
commit45e540c178533ef9aab01b1c3e782bc63061e313 (patch)
treefe126c135f706515d38676b0e491fcbbd6e7814b
parent1ced77af1a4bdbaa212a74bf0c56b2b81cdc5bd2 (diff)
downloadgit-bug-45e540c178533ef9aab01b1c3e782bc63061e313.tar.gz
bug: wrap dag.Entity into a full Bug in MergeAll
-rw-r--r--bug/bug_actions.go21
-rw-r--r--cache/repo_cache_test.go2
-rw-r--r--entity/dag/entity_actions_test.go2
-rw-r--r--identity/identity_actions_test.go2
4 files changed, 23 insertions, 4 deletions
diff --git a/bug/bug_actions.go b/bug/bug_actions.go
index 6ca5ffd7..420fb08a 100644
--- a/bug/bug_actions.go
+++ b/bug/bug_actions.go
@@ -49,7 +49,26 @@ func MergeAll(repo repository.ClockedRepo, remote string, author identity.Interf
// invalidate entities if necessary.
identityResolver := identity.NewSimpleResolver(repo)
- return dag.MergeAll(def, repo, identityResolver, remote, author)
+ out := make(chan entity.MergeResult)
+
+ go func() {
+ defer close(out)
+
+ results := dag.MergeAll(def, repo, identityResolver, remote, author)
+
+ // wrap the dag.Entity into a complete Bug
+ for result := range results {
+ result := result
+ if result.Entity != nil {
+ result.Entity = &Bug{
+ Entity: result.Entity.(*dag.Entity),
+ }
+ }
+ out <- result
+ }
+ }()
+
+ return out
}
// RemoveBug will remove a local bug from its entity.Id
diff --git a/cache/repo_cache_test.go b/cache/repo_cache_test.go
index a85fde66..35dc4ffd 100644
--- a/cache/repo_cache_test.go
+++ b/cache/repo_cache_test.go
@@ -108,7 +108,7 @@ func TestCache(t *testing.T) {
require.NoError(t, err)
}
-func TestPushPull(t *testing.T) {
+func TestCachePushPull(t *testing.T) {
repoA, repoB, remote := repository.SetupGoGitReposAndRemote()
defer repository.CleanupTestRepos(repoA, repoB, remote)
diff --git a/entity/dag/entity_actions_test.go b/entity/dag/entity_actions_test.go
index 402f459c..45e69c7d 100644
--- a/entity/dag/entity_actions_test.go
+++ b/entity/dag/entity_actions_test.go
@@ -23,7 +23,7 @@ func allEntities(t testing.TB, bugs <-chan StreamedEntity) []*Entity {
return result
}
-func TestPushPull(t *testing.T) {
+func TestEntityPushPull(t *testing.T) {
repoA, repoB, remote, id1, id2, resolver, def := makeTestContextRemote(t)
defer repository.CleanupTestRepos(repoA, repoB, remote)
diff --git a/identity/identity_actions_test.go b/identity/identity_actions_test.go
index 54cb2a46..2a5954d6 100644
--- a/identity/identity_actions_test.go
+++ b/identity/identity_actions_test.go
@@ -8,7 +8,7 @@ import (
"github.com/MichaelMure/git-bug/repository"
)
-func TestPushPull(t *testing.T) {
+func TestIdentityPushPull(t *testing.T) {
repoA, repoB, remote := repository.SetupGoGitReposAndRemote()
defer repository.CleanupTestRepos(repoA, repoB, remote)