Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
patch refs-local to skip pinning
Browse files Browse the repository at this point in the history
this is based on earlier ipfs/js-ipfs#2989 which
is no longer needed.
  • Loading branch information
koivunej committed Jul 9, 2020
1 parent 8cadebe commit 12d68b1
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions patches/0001-fix-allow-either-cidv-0-1-in-refs-local-test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From 638b0c4f1b013379a8c2d235a32e5d0ce6c103bb Mon Sep 17 00:00:00 2001
From: Joonas Koivunen <[email protected]>
Date: Sat, 18 Apr 2020 15:15:41 +0300
Subject: [PATCH] fix: allow either cidv{0,1} in refs-local test

rationale: simplest way to support using cidv0 and cidv1 interchangeably
in an ipfs implementation is to just convert all cids to cidv1
transparently. this has the miniscule setback of `refs/local` not being able
to list cids in their original version. this fix allows the
implementation to use either version internally.
---
packages/interface-ipfs-core/src/refs-local.js | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/packages/interface-ipfs-core/src/refs-local.js b/packages/interface-ipfs-core/src/refs-local.js
index 78d004de..6628ba8b 100644
--- a/packages/interface-ipfs-core/src/refs-local.js
+++ b/packages/interface-ipfs-core/src/refs-local.js
@@ -48,12 +48,17 @@ module.exports = (common, options) => {

const imported = await all(importer(dirs, ipfs.block))

- // otherwise go-ipfs doesn't show them in the local refs
- await Promise.all(
- imported.map(i => ipfs.pin.add(i.cid))
- )
+ // rust-ipfs doesn't yet have pinning api, it'll just list all local cids
+ // in /refs/local
+ if (common.opts.type !== 'rust') {
+ // otherwise go-ipfs doesn't show them in the local refs
+ await Promise.all(
+ imported.map(i => ipfs.pin.add(i.cid))
+ )
+ }

const refs = await all(ipfs.refs.local())
+
const cids = refs.map(r => r.ref)

expect(
--
2.20.1

0 comments on commit 12d68b1

Please sign in to comment.