@@ -14,8 +14,8 @@ import (
14
14
dag "github.com/ipfs/go-ipfs/merkledag"
15
15
dagtest "github.com/ipfs/go-ipfs/merkledag/test"
16
16
mfs "github.com/ipfs/go-ipfs/mfs"
17
- ft "github.com/ipfs/go-ipfs/unixfs"
18
17
cide "github.com/ipfs/go-ipfs/thirdparty/cidextra"
18
+ ft "github.com/ipfs/go-ipfs/unixfs"
19
19
20
20
mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
21
21
bstore "gx/ipfs/QmaG4DZ4JaqEfvPWt5nPPgoTzhc1tr1T3f4Nu9Jpdm8ymY/go-ipfs-blockstore"
@@ -44,6 +44,7 @@ const (
44
44
fstoreCacheOptionName = "fscache"
45
45
cidVersionOptionName = "cid-version"
46
46
hashOptionName = "hash"
47
+ idHashLimitOptionName = "id-hash-limit"
47
48
)
48
49
49
50
const adderOutChanSize = 8
@@ -120,6 +121,7 @@ You can now check what blocks have been created by:
120
121
cmdkit .BoolOption (fstoreCacheOptionName , "Check the filestore for pre-existing blocks. (experimental)" ),
121
122
cmdkit .IntOption (cidVersionOptionName , "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental)" ),
122
123
cmdkit .StringOption (hashOptionName , "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)" ).WithDefault ("sha2-256" ),
124
+ cmdkit .IntOption (idHashLimitOptionName , "Id hash maxium size. -1 disables. (experimental)" ).WithDefault (- 1 ),
123
125
},
124
126
PreRun : func (req * cmds.Request , env cmds.Environment ) error {
125
127
quiet , _ := req .Options [quietOptionName ].(bool )
@@ -173,6 +175,7 @@ You can now check what blocks have been created by:
173
175
fscache , _ := req .Options [fstoreCacheOptionName ].(bool )
174
176
cidVer , cidVerSet := req .Options [cidVersionOptionName ].(int )
175
177
hashFunStr , _ := req .Options [hashOptionName ].(string )
178
+ idHashLimit , _ := req .Options [idHashLimitOptionName ].(int )
176
179
177
180
// The arguments are subject to the following constraints.
178
181
//
@@ -282,6 +285,12 @@ You can now check what blocks have been created by:
282
285
fileAdder .NoCopy = nocopy
283
286
fileAdder .CidOpts = & cide.Opts {Prefix : prefix }
284
287
288
+ err = fileAdder .CidOpts .SetIdHashLimit (idHashLimit )
289
+ if err != nil {
290
+ res .SetError (err , cmdkit .ErrNormal )
291
+ return
292
+ }
293
+
285
294
if hash {
286
295
md := dagtest .Mock ()
287
296
emptyDirNode := ft .EmptyDirNode ()
0 commit comments