From 08d6e7844a0597d499ad19324e7269ab70340a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 30 Oct 2018 15:26:18 +0100 Subject: [PATCH] fix pin ls output when hash is specified MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Ɓukasz Magiera --- core/commands/pin.go | 2 +- test/sharness/t0085-pins.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/commands/pin.go b/core/commands/pin.go index d1626c84407..ba419e47964 100644 --- a/core/commands/pin.go +++ b/core/commands/pin.go @@ -547,7 +547,7 @@ func pinLsKeys(ctx context.Context, args []string, typeStr string, n *core.IpfsN default: pinType = "indirect through " + pinType } - keys[c.String()] = RefKeyObject{ + keys[c.Cid().String()] = RefKeyObject{ Type: pinType, } } diff --git a/test/sharness/t0085-pins.sh b/test/sharness/t0085-pins.sh index 9fac885e887..bdc285edb66 100755 --- a/test/sharness/t0085-pins.sh +++ b/test/sharness/t0085-pins.sh @@ -45,6 +45,13 @@ test_pins() { test $(cat verify_out | wc -l) > 8 ' + test_expect_success "test pin ls hash" ' + echo $HASH_B | test_must_fail grep /ipfs && # just to be sure + ipfs pin ls $HASH_B > ls_hash_out && + echo "$HASH_B recursive" > ls_hash_exp && + test_cmp ls_hash_exp ls_hash_out + ' + test_expect_success "unpin those hashes" ' cat hashes | ipfs pin rm '