Skip to content

Commit

Permalink
rename "cid format --codec" to "cid format --mc"
Browse files Browse the repository at this point in the history
  • Loading branch information
guseggert committed Jun 3, 2022
1 parent be04b86 commit 571251c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ Below is an outline of all that is in this release, so you get a sense of all th
- `ipfs cid codecs --supported` can be passed to only show codecs supported in various go-ipfs commands.

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

#### `Swarm` configuration
- Daemon will refuse to start if long-deprecated RelayV1 config key `Swarm.EnableAutoRelay` or `Swarm.DisableRelay` is set to `true`.
Expand Down
2 changes: 1 addition & 1 deletion core/commands/cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var CidCmd = &cmds.Command{
const (
cidFormatOptionName = "f"
cidVerisonOptionName = "v"
cidCodecOptionName = "codec"
cidCodecOptionName = "mc"
cidMultibaseOptionName = "b"
)

Expand Down
13 changes: 11 additions & 2 deletions test/sharness/t0290-cid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,22 @@ test_expect_success "cid hashes --numeric" '

test_expect_success "cid format -c raw" '
echo $CIDb32raw > expected &&
ipfs cid format --codec raw -b base32 $CIDb32pb > actual &&
ipfs cid format --mc raw -b base32 $CIDb32pb > actual &&
test_cmp actual expected
'

test_expect_success "cid format -c protobuf -v 0" '
echo $CIDbase > expected &&
ipfs cid format --codec dag-pb -v 0 $CIDb32raw > actual &&
ipfs cid format --mc dag-pb -v 0 $CIDb32raw > actual &&
test_cmp actual expected
'

# this was an old flag that we removed, explicitly to force an error
# so the user would read about the new multicodec names introduced
# by https://github.com/ipfs/go-cid/commit/b2064d74a8b098193b316689a715cdf4e4934805
test_expect_success "cid format --codec fails" '
echo "Error: unknown option \"codec\"" > expected &&
test_expect_code 1 ipfs cid format --codec protobuf 2> actual &&
test_cmp actual expected
'

Expand Down

0 comments on commit 571251c

Please sign in to comment.