From 2a0af78f9d9ecdcf253fe351cbc3db7a102f7f83 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 13 Sep 2018 10:57:43 -0700 Subject: [PATCH 1/3] fix output of object command We're expecting a pointer, not a value. This works in daemon mode but not in offline mode. fixes #5458 License: MIT Signed-off-by: Steven Allen --- core/commands/object/object.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/commands/object/object.go b/core/commands/object/object.go index 36e274ee1b7..e40bc5ddcd5 100644 --- a/core/commands/object/object.go +++ b/core/commands/object/object.go @@ -160,7 +160,7 @@ multihash. } } - out := Object{ + out := &Object{ Hash: rp.Cid().String(), Links: outLinks, } From 93a7b7f756f3467089219971560a170a4b95dc75 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 13 Sep 2018 11:10:29 -0700 Subject: [PATCH 2/3] don't append tabs to `object links` output License: MIT Signed-off-by: Steven Allen --- core/commands/object/object.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/commands/object/object.go b/core/commands/object/object.go index e40bc5ddcd5..aed2c67801a 100644 --- a/core/commands/object/object.go +++ b/core/commands/object/object.go @@ -183,10 +183,10 @@ multihash. w := tabwriter.NewWriter(buf, 1, 2, 1, ' ', 0) headers, _, _ := res.Request().Option("headers").Bool() if headers { - fmt.Fprintln(w, "Hash\tSize\tName\t") + fmt.Fprintln(w, "Hash\tSize\tName") } for _, link := range object.Links { - fmt.Fprintf(w, "%s\t%v\t%s\t\n", link.Hash, link.Size, link.Name) + fmt.Fprintf(w, "%s\t%v\t%s\n", link.Hash, link.Size, link.Name) } w.Flush() return buf, nil From 5629b1ce88073524c2f3fc5f930c6c4b8b4151d8 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 13 Sep 2018 11:10:43 -0700 Subject: [PATCH 3/3] test `object links` License: MIT Signed-off-by: Steven Allen --- test/sharness/t0051-object.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/sharness/t0051-object.sh b/test/sharness/t0051-object.sh index 9df03a210d5..70058be4a24 100755 --- a/test/sharness/t0051-object.sh +++ b/test/sharness/t0051-object.sh @@ -223,6 +223,12 @@ test_object_cmd() { ipfs object stat $OUTPUT ' + test_expect_success "'ipfs object links' gives the correct results" ' + echo "$EMPTY_DIR" 4 foo > expected && + ipfs object links "$OUTPUT" > actual && + test_cmp expected actual + ' + test_expect_success "'ipfs object patch add-link' should work with paths" ' EMPTY_DIR=$(ipfs object new unixfs-dir) && N1=$(ipfs object patch $EMPTY_DIR add-link baz $EMPTY_DIR) &&