Commit 56944d64 authored by Łukasz Magiera's avatar Łukasz Magiera

unixfs add: Remove hidden file handling

parent e87318a2
......@@ -34,8 +34,6 @@ type UnixfsAddSettings struct {
NoCopy bool
Wrap bool
Hidden bool
TopHidden bool
StdinName string
Events chan<- interface{}
......@@ -69,8 +67,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
NoCopy: false,
Wrap: false,
Hidden: false,
TopHidden: false,
StdinName: "",
Events: nil,
......@@ -249,23 +245,6 @@ func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption {
}
}
// Hidden enables adding of hidden files (files prefixed with '.')
func (unixfsOpts) Hidden(hidden bool) UnixfsAddOption {
return func(settings *UnixfsAddSettings) error {
settings.Hidden = hidden
return nil
}
}
// TopHidden enables adding of hidden files in top-level directory (files
// prefixed with '.')
func (unixfsOpts) TopHidden(hidden bool) UnixfsAddOption {
return func(settings *UnixfsAddSettings) error {
settings.TopHidden = hidden
return nil
}
}
// StdinName is the name set for files which don specify FilePath as
// os.Stdin.Name()
func (unixfsOpts) StdinName(name string) UnixfsAddOption {
......
......@@ -328,7 +328,7 @@ func (tp *provider) TestAdd(t *testing.T) {
},
// hidden
{
name: "hiddenFiles",
name: "hiddenFilesAdded",
data: func() files.Node {
return files.NewMapDirectory(map[string]files.Node{
".bar": files.NewBytesFile([]byte("hello2")),
......@@ -339,48 +339,6 @@ func (tp *provider) TestAdd(t *testing.T) {
wrap: "t",
expect: wrapped("t"),
path: "/ipfs/QmPXLSBX382vJDLrGakcbrZDkU3grfkjMox7EgSC9KFbtQ",
opts: []options.UnixfsAddOption{options.Unixfs.Hidden(true)},
},
{
name: "topHiddenFileAdded",
data: func() files.Node {
return files.NewBytesFile([]byte(helloStr))
},
wrap: ".foo",
expect: wrapped(".foo"),
path: "/ipfs/QmciAVG3krCbvzUaK9gr6jUgfEjQtYmuuXi1n67teQ4Ni2",
opts: []options.UnixfsAddOption{options.Unixfs.TopHidden(true)},
},
{
name: "hiddenFilesNotAdded",
data: func() files.Node {
return files.NewMapDirectory(map[string]files.Node{
".bar": files.NewBytesFile([]byte("hello2")),
"bar": files.NewBytesFile([]byte("hello2")),
"foo": files.NewBytesFile([]byte("hello1")),
})
},
expect: func(files.Node) files.Node {
return flatDir()
},
path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp",
opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)},
},
{
name: "hiddenFilesWrappedNotAdded",
data: func() files.Node {
return files.NewMapDirectory(map[string]files.Node{
".bar": files.NewBytesFile([]byte("hello2")),
"bar": files.NewBytesFile([]byte("hello2")),
"foo": files.NewBytesFile([]byte("hello1")),
})
},
expect: func(files.Node) files.Node {
return wrapped("t")(flatDir())
},
wrap: "t",
path: "/ipfs/Qmc3nGXm1HtUVCmnXLQHvWcNwfdZGpfg2SRm1CxLf7Q2Rm",
opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)},
},
// NoCopy
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment