Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ccca905

Browse files
committedJan 17, 2019
Change --force-cid-base to --upgrade-cidv0-in-output.
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
1 parent 6c97019 commit ccca905

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed
 

‎core/commands/cmdenv/cidbase.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
var OptionCidBase = cmdkit.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.")
14-
var OptionForceCidBase = cmdkit.BoolOption("force-cid-base", "Force multibase prefix by upgrading CIDv0 to CIDv1.")
14+
var OptionUpgradeCidV0InOutput = cmdkit.BoolOption("upgrade-cidv0-in-output", "Upgrade version 0 to version 1 CIDs in output.")
1515

1616
// GetCidEncoder processes the `cid-base` and `output-cidv1` options and
1717
// returns a encoder to use based on those parameters.
@@ -28,7 +28,7 @@ func GetLowLevelCidEncoder(req *cmds.Request) (cidenc.Encoder, error) {
2828

2929
func getCidBase(req *cmds.Request, autoUpgrade bool) (cidenc.Encoder, error) {
3030
base, _ := req.Options[OptionCidBase.Name()].(string)
31-
upgrade, upgradeDefined := req.Options[OptionForceCidBase.Name()].(bool)
31+
upgrade, upgradeDefined := req.Options[OptionUpgradeCidV0InOutput.Name()].(bool)
3232

3333
e := cidenc.Default()
3434

‎core/commands/root.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The CLI will exit with one of the following values:
100100

101101
// global options, added to every command
102102
cmdenv.OptionCidBase,
103-
cmdenv.OptionForceCidBase,
103+
cmdenv.OptionUpgradeCidV0InOutput,
104104

105105
cmds.OptionEncodingType,
106106
cmds.OptionStreamChannels,

‎test/sharness/t0040-add-and-cat.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -292,20 +292,20 @@ test_add_cat_file() {
292292
test_cmp expected oh_actual
293293
'
294294

295-
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false succeeds" '
295+
test_expect_success "ipfs add --cid-base=base32 --upgrade-cidv0-in-output=false succeeds" '
296296
echo "base32 test" >mountdir/base32-test.txt &&
297-
ipfs add --cid-base=base32 --force-cid-base=false mountdir/base32-test.txt >actual
297+
ipfs add --cid-base=base32 --upgrade-cidv0-in-output=false mountdir/base32-test.txt >actual
298298
'
299-
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false output looks good" '
299+
test_expect_success "ipfs add --cid-base=base32 --upgrade-cidv0-in-output=false output looks good" '
300300
HASHv0=$(cid-fmt -v 0 -b z %s "$HASHb32") &&
301301
echo "added $HASHv0 base32-test.txt" >expected &&
302302
test_cmp expected actual
303303
'
304304

305-
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false --only-hash succeeds" '
306-
ipfs add --cid-base=base32 --force-cid-base=false --only-hash mountdir/base32-test.txt > oh_actual
305+
test_expect_success "ipfs add --cid-base=base32 --upgrade-cidv0-in-output=false --only-hash succeeds" '
306+
ipfs add --cid-base=base32 --upgrade-cidv0-in-output=false --only-hash mountdir/base32-test.txt > oh_actual
307307
'
308-
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false --only-hash output looks good" '
308+
test_expect_success "ipfs add --cid-base=base32 --upgrade-cidv0-in-output=false --only-hash output looks good" '
309309
test_cmp expected oh_actual
310310
'
311311

‎test/sharness/t0051-object.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,11 @@ test_object_cmd() {
363363
test_cmp expected_putOut actual_putOut
364364
'
365365

366-
test_expect_success "'ipfs object put file.json --cid-base=base32 --force-cid-base=true' succeeds" '
367-
ipfs object put --cid-base=base32 --force-cid-base=true ../t0051-object-data/testPut.json > actual_putOut
366+
test_expect_success "'ipfs object put file.json --cid-base=base32 --upgrade-cidv0-in-output=true' succeeds" '
367+
ipfs object put --cid-base=base32 --upgrade-cidv0-in-output=true ../t0051-object-data/testPut.json > actual_putOut
368368
'
369369

370-
test_expect_success "'ipfs object put file.json --cid-base=base32 --force-cid-base=true' output looks good" '
370+
test_expect_success "'ipfs object put file.json --cid-base=base32 --upgrade-cidv0-in-output=true' output looks good" '
371371
HASH=$(ipfs cid base32 "QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD") &&
372372
printf "added $HASH\n" > expected_putOut &&
373373
test_cmp expected_putOut actual_putOut
@@ -394,8 +394,8 @@ test_object_cmd() {
394394
grep -q $(ipfs cid base32 $HASHv1) mixed.actual
395395
'
396396

397-
test_expect_success "ipfs object links --cid-base=base32 --force-cid-base=true converts both links" '
398-
ipfs object links --cid-base=base32 --force-cid-base=true $MIXED | awk "{print \$1}" | sort > links.actual &&
397+
test_expect_success "ipfs object links --cid-base=base32 --upgrade-cidv0-in-output=true converts both links" '
398+
ipfs object links --cid-base=base32 --upgrade-cidv0-in-output=true $MIXED | awk "{print \$1}" | sort > links.actual &&
399399
echo $(ipfs cid base32 $HASHv1) > links.expected
400400
echo $(ipfs cid base32 $HASHv0) >> links.expected
401401
test_cmp links.actual links.expected

0 commit comments

Comments
 (0)
Please sign in to comment.