Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
ade598ee
提交
ade598ee
authored
8月 31, 2016
作者:
Jeromy Johnson
提交者:
GitHub
8月 31, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3135 from ipfs/kevina/2839directfix
Directly Fix #2839
上级
04d3e792
802d3f95
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
30 行增加
和
17 行删除
+30
-17
parse.go
commands/cli/parse.go
+5
-7
t0040-add-and-cat.sh
test/sharness/t0040-add-and-cat.sh
+16
-0
t0044-add-symlink.sh
test/sharness/t0044-add-symlink.sh
+9
-10
没有找到文件。
commands/cli/parse.go
浏览文件 @
ade598ee
...
...
@@ -401,16 +401,14 @@ func appendFile(fpath string, argDef *cmds.Argument, recursive, hidden bool) (fi
if
err
!=
nil
{
return
nil
,
err
}
cwd
,
err
=
filepath
.
EvalSymlinks
(
cwd
)
if
err
!=
nil
{
return
nil
,
err
}
fpath
=
cwd
}
fpath
=
filepath
.
Clean
(
fpath
)
fpath
,
err
:=
filepath
.
EvalSymlinks
(
fpath
)
if
err
!=
nil
{
return
nil
,
err
}
// Repeat ToSlash after EvalSymlinks as it turns path to platform specific
fpath
=
filepath
.
ToSlash
(
fpath
)
fpath
=
filepath
.
ToSlash
(
filepath
.
Clean
(
fpath
))
stat
,
err
:=
os
.
Lstat
(
fpath
)
if
err
!=
nil
{
...
...
test/sharness/t0040-add-and-cat.sh
浏览文件 @
ade598ee
...
...
@@ -189,6 +189,18 @@ test_add_named_pipe() {
'
}
test_add_pwd_is_symlink
()
{
test_expect_success
"ipfs add -r adds directory content when ./ is symlink"
'
mkdir hellodir &&
echo "World" > hellodir/world &&
ln -s hellodir hellolink &&
( cd hellolink &&
ipfs add -r . > ../actual ) &&
grep "added Qma9CyFdG5ffrZCcYSin2uAETygB25cswVwEYYzwfQuhTe" actual &&
rm -r hellodir
'
}
test_launch_ipfs_daemon_and_mount
test_expect_success
"'ipfs add --help' succeeds"
'
...
...
@@ -373,6 +385,8 @@ test_add_cat_expensive
test_add_named_pipe
" Post http://
$API_ADDR
/api/v0/add?encoding=json&progress=true&r=true&stream-channels=true:"
test_add_pwd_is_symlink
test_kill_ipfs_daemon
# should work offline
...
...
@@ -390,6 +404,8 @@ test_expect_success "ipfs cat file fails" '
test_add_named_pipe
""
test_add_pwd_is_symlink
# Test daemon in offline mode
test_launch_ipfs_daemon
--offline
...
...
test/sharness/t0044-add-symlink.sh
浏览文件 @
ade598ee
...
...
@@ -11,13 +11,9 @@ test_description="Test add -w"
test_expect_success
"creating files succeeds"
'
mkdir -p files/foo &&
mkdir -p files/bar &&
mkdir -p files/badin
echo "some text" > files/foo/baz &&
ln -s ../foo/baz files/bar/baz &&
ln -s files/does/not/exist files/badin/bad &&
mkdir -p files2/a/b/c &&
echo "some other text" > files2/a/b/c/foo &&
ln -s b files2/a/d
ln -s files/foo/baz files/bar/baz &&
ln -s files/does/not/exist files/bad
'
test_add_symlinks
()
{
...
...
@@ -27,21 +23,21 @@ test_add_symlinks() {
'
test_expect_success
"output looks good"
'
echo Qm
QRgZT6xVFKJLVVpJDu3WcPkw2iqQ1jqK1F9jmdeq9zAv
> filehash_exp &&
echo Qm
WdiHKoeSW8G1u7ATCgpx4yMoUhYaJBQGkyPLkS9goYZ8
> filehash_exp &&
test_cmp filehash_exp filehash_out
'
test_expect_success
"adding a symlink adds the
file
itself"
'
test_expect_success
"adding a symlink adds the
link
itself"
'
ipfs add -q files/bar/baz > goodlink_out
'
test_expect_success
"output looks good"
'
echo
QmcPNXE5zjkWkM24xQ7Bi3VAm8fRxiaNp88jFsij7kSQF1
> goodlink_exp &&
echo
"QmdocmZeF7qwPT9Z8SiVhMSyKA2KKoA2J7jToW6z6WBmxR"
> goodlink_exp &&
test_cmp goodlink_exp goodlink_out
'
test_expect_success
"adding a broken symlink works"
'
ipfs add -q
r files/badin | head -1
> badlink_out
ipfs add -q
files/bad
> badlink_out
'
test_expect_success
"output looks good"
'
...
...
@@ -51,6 +47,9 @@ test_add_symlinks() {
test_expect_success
"adding with symlink in middle of path is same as
\
adding with no symlink"
'
mkdir -p files2/a/b/c &&
echo "some other text" > files2/a/b/c/foo &&
ln -s b files2/a/d
ipfs add -rq files2/a/b/c > no_sym &&
ipfs add -rq files2/a/d/c > sym &&
test_cmp no_sym sym
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论