Skip to content

Commit eb1eaa8

Browse files
committed
rename "cid format --codec" to "cid format --mc"
1 parent be04b86 commit eb1eaa8

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ Below is an outline of all that is in this release, so you get a sense of all th
5454
- `ipfs cid codecs --supported` can be passed to only show codecs supported in various go-ipfs commands.
5555

5656
#### `ipfs cid format` command
57-
- CidV0 Now correctly requires the `dag-pb` codec, instead of the `protobuf` codec.
57+
- `--codec` was removed and replaced with `--mc` to ensure existing users are aware of the following changes:
58+
- `--mc protobuf` now correctly points to code `0x50` (was `0x70`, which is `dab-pg`)
59+
- `--mc cbor` now correctly points to code `0x51` (was `0x71`, which is `dag-cbor`)
5860

5961
#### `Swarm` configuration
6062
- Daemon will refuse to start if long-deprecated RelayV1 config key `Swarm.EnableAutoRelay` or `Swarm.DisableRelay` is set to `true`.

core/commands/cid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var CidCmd = &cmds.Command{
3535
const (
3636
cidFormatOptionName = "f"
3737
cidVerisonOptionName = "v"
38-
cidCodecOptionName = "codec"
38+
cidCodecOptionName = "mc"
3939
cidMultibaseOptionName = "b"
4040
)
4141

test/sharness/t0290-cid.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CIDb32="bafybeibxm2nsadl3fnxv2sxcxmxaco2jl53wpeorjdzidjwf5aqdg7wa6u"
1313
CIDbase="QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6"
1414
CIDb32pb="bafybeievd6mwe6vcwnkwo3eizs3h7w3a34opszbyfxziqdxguhjw7imdve"
1515
CIDb32raw="bafkreievd6mwe6vcwnkwo3eizs3h7w3a34opszbyfxziqdxguhjw7imdve"
16+
CIDb32dagcbor="bafyreievd6mwe6vcwnkwo3eizs3h7w3a34opszbyfxziqdxguhjw7imdve"
1617

1718
test_expect_success "cid base32 works" '
1819
echo $CIDb32 > expected &&
@@ -284,13 +285,28 @@ test_expect_success "cid hashes --numeric" '
284285

285286
test_expect_success "cid format -c raw" '
286287
echo $CIDb32raw > expected &&
287-
ipfs cid format --codec raw -b base32 $CIDb32pb > actual &&
288+
ipfs cid format --mc raw -b base32 $CIDb32pb > actual &&
288289
test_cmp actual expected
289290
'
290291

291-
test_expect_success "cid format -c protobuf -v 0" '
292+
test_expect_success "cid format --mc dag-pb -v 0" '
292293
echo $CIDbase > expected &&
293-
ipfs cid format --codec dag-pb -v 0 $CIDb32raw > actual &&
294+
ipfs cid format --mc dag-pb -v 0 $CIDb32raw > actual &&
295+
test_cmp actual expected
296+
'
297+
298+
test_expect_success "cid format --mc dag-cbor" '
299+
echo $CIDb32dagcbor > expected &&
300+
ipfs cid format --mc dag-cbor $CIDb32pb > actual &&
301+
test_cmp actual expected
302+
'
303+
304+
# this was an old flag that we removed, explicitly to force an error
305+
# so the user would read about the new multicodec names introduced
306+
# by https://github.com/ipfs/go-cid/commit/b2064d74a8b098193b316689a715cdf4e4934805
307+
test_expect_success "cid format --codec fails" '
308+
echo "Error: unknown option \"codec\"" > expected &&
309+
test_expect_code 1 ipfs cid format --codec protobuf 2> actual &&
294310
test_cmp actual expected
295311
'
296312

0 commit comments

Comments
 (0)