fix resolve call in object diff
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Jeromy committed
Apr 19, 2016 at 15:57 UTC
6d90fe35caa309c2206790324efead2812103ef7
1 file changed
+11
-6
core/commands/object/diff.go
+11
-6
@@ -6,10 +6,15 @@ import (
6
"io"
7
8
cmds "github.com/ipfs/go-ipfs/commands"
9
+ core "github.com/ipfs/go-ipfs/core"
10
dagutils "github.com/ipfs/go-ipfs/merkledag/utils"
11
path "github.com/ipfs/go-ipfs/path"
12
)
13
14
+type Changes struct {
15
+ Changes []*dagutils.Change
16
+}
17
+
18
var ObjectDiffCmd = &cmds.Command{
19
Helptext: cmds.HelpText{
20
Tagline: "takes a diff of the two given objects",
@@ -68,13 +73,13 @@ Example:
73
74
ctx := req.Context()
75
71
- obj_a, err := node.Resolver.ResolvePath(ctx, pa)
76
+ obj_a, err := core.Resolve(ctx, node, pa)
77
if err != nil {
78
res.SetError(err, cmds.ErrNormal)
79
return
80
}
81
77
- obj_b, err := node.Resolver.ResolvePath(ctx, pb)
82
+ obj_b, err := core.Resolve(ctx, node, pb)
83
if err != nil {
84
res.SetError(err, cmds.ErrNormal)
85
return
@@ -86,15 +91,15 @@ Example:
91
return
92
}
93
89
- res.SetOutput(changes)
94
+ res.SetOutput(&Changes{changes})
95
},
91
- Type: []*dagutils.Change{},
96
+ Type: Changes{},
97
Marshalers: cmds.MarshalerMap{
98
cmds.Text: func(res cmds.Response) (io.Reader, error) {
99
verbose, _, _ := res.Request().Option("v").Bool()
95
- changes := res.Output().([]*dagutils.Change)
100
+ changes := res.Output().(*Changes)
101
buf := new(bytes.Buffer)
97
- for _, change := range changes {
102
+ for _, change := range changes.Changes {
103
if verbose {
104
switch change.Type {
105
case dagutils.Add: