mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
Merge pull request #6669 from ipfs/fix/6648
pin: fix pin update X Y where X==Y
This commit is contained in:
commit
6e1e6db949
@ -516,6 +516,14 @@ func (p *pinner) RecursiveKeys() []cid.Cid {
|
||||
// this is more efficient than simply pinning the new one and unpinning the
|
||||
// old one
|
||||
func (p *pinner) Update(ctx context.Context, from, to cid.Cid, unpin bool) error {
|
||||
if from == to {
|
||||
// Nothing to do. Don't remove this check or we'll end up
|
||||
// _removing_ the pin.
|
||||
//
|
||||
// See #6648
|
||||
return nil
|
||||
}
|
||||
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
|
||||
@ -101,6 +101,9 @@ test_pins() {
|
||||
ipfs pin ls $LS_ARGS $BASE_ARGS > after_update &&
|
||||
test_must_fail grep -q "$HASH_A" after_update &&
|
||||
test_should_contain "$HASH_B" after_update &&
|
||||
ipfs pin update --unpin=true "$HASH_B" "$HASH_B" &&
|
||||
ipfs pin ls $LS_ARGS $BASE_ARGS > after_idempotent_update &&
|
||||
test_should_contain "$HASH_B" after_idempotent_update &&
|
||||
ipfs pin rm "$HASH_B"
|
||||
'
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user