diff options
author | Michael Muré <batolettre@gmail.com> | 2021-05-03 11:45:15 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-08-22 13:25:26 +0200 |
commit | 45b04351d8d02e53b3401b0ee23f7cbe750b63cd (patch) | |
tree | 59d203ef6c0f6a497b7074cd5617c8869cac3b14 /bridge/github | |
parent | 43026fc53669d462a60feec7d22aec090959be72 (diff) | |
download | git-bug-45b04351d8d02e53b3401b0ee23f7cbe750b63cd.tar.gz git-bug-45b04351d8d02e53b3401b0ee23f7cbe750b63cd.zip |
bug: have a type for combined ids, fix https://github.com/MichaelMure/git-bug/issues/653
Diffstat (limited to 'bridge/github')
-rw-r--r-- | bridge/github/export_test.go | 7 | ||||
-rw-r--r-- | bridge/github/import.go | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/bridge/github/export_test.go b/bridge/github/export_test.go index 93cc47c0..de2d3f34 100644 --- a/bridge/github/export_test.go +++ b/bridge/github/export_test.go @@ -16,6 +16,7 @@ import ( "github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/bridge/core/auth" "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/entity/dag" "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/interrupt" @@ -66,13 +67,15 @@ func testCases(t *testing.T, repo *cache.RepoCache) []*testCase { bugWithCommentEditions, createOp, err := repo.NewBug("bug with comments editions", "new bug") require.NoError(t, err) - _, err = bugWithCommentEditions.EditComment(createOp.Id(), "first comment edited") + _, err = bugWithCommentEditions.EditComment( + entity.CombineIds(bugWithCommentEditions.Id(), createOp.Id()), "first comment edited") require.NoError(t, err) commentOp, err := bugWithCommentEditions.AddComment("first comment") require.NoError(t, err) - _, err = bugWithCommentEditions.EditComment(commentOp.Id(), "first comment edited") + _, err = bugWithCommentEditions.EditComment( + entity.CombineIds(bugWithCommentEditions.Id(), commentOp.Id()), "first comment edited") require.NoError(t, err) // bug status changed diff --git a/bridge/github/import.go b/bridge/github/import.go index 722bf256..5b2bf54b 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -405,6 +405,7 @@ func (gi *githubImporter) ensureCommentEdit(ctx context.Context, repo *cache.Rep if err != nil { return err } + // check if the comment edition already exist _, err = b.ResolveOperationWithMetadata(metaKeyGithubId, parseId(edit.Id)) if err == nil { return nil @@ -428,7 +429,7 @@ func (gi *githubImporter) ensureCommentEdit(ctx context.Context, repo *cache.Rep op, err := b.EditCommentRaw( editor, edit.CreatedAt.Unix(), - target, + entity.CombineIds(b.Id(), target), text.Cleanup(string(*edit.Diff)), map[string]string{ metaKeyGithubId: parseId(edit.Id), |