diff --git a/core/commands/pin.go b/core/commands/pin.go index 01fbafca79c4..8668a1b53dd8 100644 --- a/core/commands/pin.go +++ b/core/commands/pin.go @@ -40,7 +40,7 @@ var PinCmd = &cmds.Command{ type PinOutput struct { Pins []string - Error string + Error string `json:",omitempty"` } // PinUpdateOutput represents the pin update output @@ -74,18 +74,11 @@ var addPinCmd = &cmds.Command{ }, Type: AddPinOutput{}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { - n, err := cmdenv.GetNode(env) - if err != nil { - return err - } - api, err := cmdenv.GetApi(env) if err != nil { return err } - defer n.Blockstore.PinLock().Unlock() - // set recursive flag recursive, _ := req.Options[pinRecursiveOptionName].(bool) showProgress, _ := req.Options[pinProgressOptionName].(bool) diff --git a/test/sharness/t0080-repo.sh b/test/sharness/t0080-repo.sh index 16e3042170a2..7655268bb2f3 100755 --- a/test/sharness/t0080-repo.sh +++ b/test/sharness/t0080-repo.sh @@ -93,7 +93,8 @@ test_expect_success "pinning directly should fail now" ' ' test_expect_success "'ipfs pin rm -r=false ' should fail" ' - echo "Error: $HASH is pinned recursively" >expected4 && + echo "cannot unpin $HASH: $HASH is pinned recursively" >expected4 && + echo "Error: some hash not unpinned" >>expected4 && test_must_fail ipfs pin rm -r=false "$HASH" 2>actual4 && test_cmp expected4 actual4 '