Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
973707a8
提交
973707a8
authored
2月 19, 2016
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix minor mfs truncate bug
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
上级
8e4cfed0
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
35 行增加
和
2 行删除
+35
-2
dir.go
mfs/dir.go
+1
-1
t0250-files-api.sh
test/sharness/t0250-files-api.sh
+19
-0
dagmodifier.go
unixfs/mod/dagmodifier.go
+1
-1
dagmodifier_test.go
unixfs/mod/dagmodifier_test.go
+14
-0
没有找到文件。
mfs/dir.go
浏览文件 @
973707a8
...
...
@@ -126,7 +126,7 @@ func (d *Directory) childNode(name string) (FSNode, error) {
ndir
:=
NewDirectory
(
d
.
ctx
,
name
,
nd
,
d
,
d
.
dserv
)
d
.
childDirs
[
name
]
=
ndir
return
ndir
,
nil
case
ufspb
.
Data_File
:
case
ufspb
.
Data_File
,
ufspb
.
Data_Raw
:
nfi
,
err
:=
NewFile
(
name
,
nd
,
d
,
d
.
dserv
)
if
err
!=
nil
{
return
nil
,
err
...
...
test/sharness/t0250-files-api.sh
浏览文件 @
973707a8
...
...
@@ -358,6 +358,25 @@ test_files_api() {
verify_dir_contents /
'
# test truncating
test_expect_success
"create a new file"
'
echo "some content" | ipfs files write --create /cats
'
test_expect_success
"truncate and write over that file"
'
echo "fish" | ipfs files write --truncate /cats
'
test_expect_success
"output looks good"
'
ipfs files read /cats > file_out &&
echo "fish" > file_exp &&
test_cmp file_out file_exp
'
test_expect_success
"cleanup"
'
ipfs files rm /cats
'
# test flush flags
test_expect_success
"mkdir --flush works"
'
ipfs files mkdir --flush --parents /flushed/deep
...
...
unixfs/mod/dagmodifier.go
浏览文件 @
973707a8
...
...
@@ -6,8 +6,8 @@ import (
"io"
"os"
proto
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
mh
"gx/ipfs/QmYf7ng2hG5XBtJA3tN34DQ2GUN5HNksEw1rLDkmr6vGku/go-multihash"
proto
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
key
"github.com/ipfs/go-ipfs/blocks/key"
...
...
unixfs/mod/dagmodifier_test.go
浏览文件 @
973707a8
...
...
@@ -447,6 +447,20 @@ func TestDagTruncate(t *testing.T) {
if
size
!=
10
{
t
.
Fatal
(
"size was incorrect!"
)
}
err
=
dagmod
.
Truncate
(
0
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
size
,
err
=
dagmod
.
Size
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
size
!=
0
{
t
.
Fatal
(
"size was incorrect!"
)
}
}
func
TestSparseWrite
(
t
*
testing
.
T
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论