From 60fcfcdcb0e89741528cfc99a94a48f204d48e6b Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 12 Sep 2018 16:57:04 +0200 Subject: bug: change the OperationPack serialization format for Json See https://github.com/MichaelMure/git-bug/issues/5 for the details of this choice --- bug/bug.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bug/bug.go') diff --git a/bug/bug.go b/bug/bug.go index ac078866..e548757e 100644 --- a/bug/bug.go +++ b/bug/bug.go @@ -1,6 +1,7 @@ package bug import ( + "encoding/json" "errors" "fmt" "strings" @@ -193,20 +194,21 @@ func readBug(repo repository.Repo, ref string) (*Bug, error) { return nil, err } - op, err := ParseOperationPack(data) + opp := &OperationPack{} + err = json.Unmarshal(data, &opp) if err != nil { return nil, err } // tag the pack with the commit hash - op.commitHash = hash + opp.commitHash = hash if err != nil { return nil, err } - bug.packs = append(bug.packs, *op) + bug.packs = append(bug.packs, *opp) } return &bug, nil @@ -450,7 +452,7 @@ func makeMediaTree(pack OperationPack) []repository.TreeEntry { added := make(map[git.Hash]interface{}) for _, ops := range pack.Operations { - for _, file := range ops.Files() { + for _, file := range ops.GetFiles() { if _, has := added[file]; !has { tree = append(tree, repository.TreeEntry{ ObjectType: repository.Blob, -- cgit