diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-12 16:57:04 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-12 16:57:46 +0200 |
commit | 60fcfcdcb0e89741528cfc99a94a48f204d48e6b (patch) | |
tree | 48189b7f85e10b1bdf6a4b897ac0b966c4cec23c /bug/bug.go | |
parent | 3605887345792d2f981f971c6c4a2cb7f86a343e (diff) | |
download | git-bug-60fcfcdcb0e89741528cfc99a94a48f204d48e6b.tar.gz |
bug: change the OperationPack serialization format for Json
See https://github.com/MichaelMure/git-bug/issues/5 for the details of this choice
Diffstat (limited to 'bug/bug.go')
-rw-r--r-- | bug/bug.go | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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, |