Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
149819f8
提交
149819f8
authored
8月 01, 2016
作者:
Jeromy Johnson
提交者:
GitHub
8月 01, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3007 from ipfs/feature/refs-format-regression
commands: fix refs 'edges' option work
上级
0bd8ced0
66686e66
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
30 行增加
和
8 行删除
+30
-8
refs.go
core/commands/refs.go
+11
-6
t0500-issues-and-regressions-offline.sh
test/sharness/t0500-issues-and-regressions-offline.sh
+19
-2
没有找到文件。
core/commands/refs.go
浏览文件 @
149819f8
...
...
@@ -74,17 +74,26 @@ NOTE: List all references recursively by using the flag '-r'.
return
}
edges
,
_
,
err
:=
req
.
Option
(
"edges"
)
.
Bool
()
format
,
_
,
err
:=
req
.
Option
(
"format"
)
.
String
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
format
,
_
,
err
:=
req
.
Option
(
"format"
)
.
String
()
edges
,
_
,
err
:=
req
.
Option
(
"edges"
)
.
Bool
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
if
edges
{
if
format
!=
"<dst>"
{
res
.
SetError
(
errors
.
New
(
"using format arguement with edges is not allowed"
),
cmds
.
ErrClient
)
return
}
format
=
"<src> -> <dst>"
}
objs
,
err
:=
objectsForPaths
(
ctx
,
n
,
req
.
Arguments
())
if
err
!=
nil
{
...
...
@@ -103,7 +112,6 @@ NOTE: List all references recursively by using the flag '-r'.
DAG
:
n
.
DAG
,
Ctx
:
ctx
,
Unique
:
unique
,
PrintEdge
:
edges
,
PrintFmt
:
format
,
Recursive
:
recursive
,
}
...
...
@@ -210,7 +218,6 @@ type RefWriter struct {
Unique
bool
Recursive
bool
PrintEdge
bool
PrintFmt
string
seen
map
[
key
.
Key
]
struct
{}
...
...
@@ -315,8 +322,6 @@ func (rw *RefWriter) WriteEdge(from, to key.Key, linkname string) error {
s
=
strings
.
Replace
(
s
,
"<src>"
,
from
.
B58String
(),
-
1
)
s
=
strings
.
Replace
(
s
,
"<dst>"
,
to
.
B58String
(),
-
1
)
s
=
strings
.
Replace
(
s
,
"<linkname>"
,
linkname
,
-
1
)
case
rw
.
PrintEdge
:
s
=
from
.
B58String
()
+
" -> "
+
to
.
B58String
()
default
:
s
+=
to
.
B58String
()
}
...
...
test/sharness/t0500-issues-and-regressions-offline.sh
浏览文件 @
149819f8
...
...
@@ -4,8 +4,6 @@ test_description="Tests for various fixed issues and regressions."
.
lib/test-lib.sh
test_init_ipfs
# Tests go here
test_expect_success
"ipfs init with occupied input works - #2748"
'
...
...
@@ -13,6 +11,7 @@ test_expect_success "ipfs init with occupied input works - #2748" '
echo "" | time-out ipfs init &&
rm -rf ipfs_path
'
test_init_ipfs
test_expect_success
"ipfs cat --help succeeds with no input"
'
time-out ipfs cat --help
...
...
@@ -22,4 +21,22 @@ test_expect_success "ipfs pin ls --help succeeds with no input" '
time-out ipfs pin ls --help
'
test_expect_success
"ipfs add on 1MB from stdin woks"
'
random 1048576 42 | ipfs add -q > 1MB.hash
'
test_expect_success
"'ipfs refs -r -e
\$
(cat 1MB.hash)' succeeds"
'
ipfs refs -r -e $(cat 1MB.hash) > refs-e.out
'
test_expect_success
"output of 'ipfs refs -e' links to separate blocks"
'
grep "$(cat 1MB.hash) ->" refs-e.out
'
test_expect_success
"output of 'ipfs refs -e' contains all first level links"
'
grep "$(cat 1MB.hash) ->" refs-e.out | sed -e '
\'
's/.* -> //'
\'
' | sort > refs-s.out &&
ipfs refs "$(cat 1MB.hash)" | sort > refs-one.out &&
test_cmp refs-s.out refs-one.out
'
test_done
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论