Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
57457af7
提交
57457af7
authored
1月 07, 2019
作者:
Kevin Atkinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change --output-cidv1 to --force-cid-base.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
上级
8209ba61
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
9 行增加
和
9 行删除
+9
-9
cidbase.go
core/commands/cmdenv/cidbase.go
+3
-3
root.go
core/commands/root.go
+1
-1
t0051-object.sh
test/sharness/t0051-object.sh
+5
-5
没有找到文件。
core/commands/cmdenv/cidbase.go
浏览文件 @
57457af7
...
...
@@ -10,7 +10,7 @@ import (
)
var
OptionCidBase
=
cmdkit
.
StringOption
(
"cid-base"
,
"Multibase encoding used for version 1 CIDs in output."
)
var
Option
OutputCidV1
=
cmdkit
.
BoolOption
(
"output-cidv1"
,
"Upgrade CID version 0 to version 1 in output
."
)
var
Option
ForceCidBase
=
cmdkit
.
BoolOption
(
"force-cid-base"
,
"Force multibase prefix by upgrading CIDv0 to CIDv1
."
)
// GetCidEncoder processes the `cid-base` and `output-cidv1` options and
// returns a encoder to use based on those parameters.
...
...
@@ -26,8 +26,8 @@ func GetLowLevelCidEncoder(req *cmds.Request) (cidenc.Encoder, error) {
}
func
getCidBase
(
req
*
cmds
.
Request
,
autoUpgrade
bool
)
(
cidenc
.
Encoder
,
error
)
{
base
,
_
:=
req
.
Options
[
"cid-base"
]
.
(
string
)
upgrade
,
upgradeDefined
:=
req
.
Options
[
"output-cidv1"
]
.
(
bool
)
base
,
_
:=
req
.
Options
[
OptionCidBase
.
Name
()
]
.
(
string
)
upgrade
,
upgradeDefined
:=
req
.
Options
[
OptionForceCidBase
.
Name
()
]
.
(
bool
)
e
:=
cidenc
.
Default
()
...
...
core/commands/root.go
浏览文件 @
57457af7
...
...
@@ -100,7 +100,7 @@ The CLI will exit with one of the following values:
// global options, added to every command
cmdenv
.
OptionCidBase
,
cmdenv
.
Option
OutputCidV1
,
cmdenv
.
Option
ForceCidBase
,
cmds
.
OptionEncodingType
,
cmds
.
OptionStreamChannels
,
...
...
test/sharness/t0051-object.sh
浏览文件 @
57457af7
...
...
@@ -363,11 +363,11 @@ test_object_cmd() {
test_cmp expected_putOut actual_putOut
'
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
output-cidv1
=true' succeeds"
'
ipfs object put --cid-base=base32 --
output-cidv1
=true ../t0051-object-data/testPut.json > actual_putOut
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
force-cid-base
=true' succeeds"
'
ipfs object put --cid-base=base32 --
force-cid-base
=true ../t0051-object-data/testPut.json > actual_putOut
'
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
output-cidv1
=true' output looks good"
'
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
force-cid-base
=true' output looks good"
'
HASH=$(ipfs cid base32 "QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD") &&
printf "added $HASH\n" > expected_putOut &&
test_cmp expected_putOut actual_putOut
...
...
@@ -394,8 +394,8 @@ test_object_cmd() {
grep -q $(ipfs cid base32 $HASHv1) mixed.actual
'
test_expect_success
"ipfs object links --cid-base=base32 --
output-cidv1
=true converts both links"
'
ipfs object links --cid-base=base32 --
output-cidv1
=true $MIXED | awk "{print \$1}" | sort > links.actual &&
test_expect_success
"ipfs object links --cid-base=base32 --
force-cid-base
=true converts both links"
'
ipfs object links --cid-base=base32 --
force-cid-base
=true $MIXED | awk "{print \$1}" | sort > links.actual &&
echo $(ipfs cid base32 $HASHv1) > links.expected
echo $(ipfs cid base32 $HASHv0) >> links.expected
test_cmp links.actual links.expected
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论