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 { ...@@ -34,8 +34,6 @@ type UnixfsAddSettings struct {
NoCopy bool NoCopy bool
Wrap bool Wrap bool
Hidden bool
TopHidden bool
StdinName string StdinName string
Events chan<- interface{} Events chan<- interface{}
...@@ -69,8 +67,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, ...@@ -69,8 +67,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
NoCopy: false, NoCopy: false,
Wrap: false, Wrap: false,
Hidden: false,
TopHidden: false,
StdinName: "", StdinName: "",
Events: nil, Events: nil,
...@@ -249,23 +245,6 @@ func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption { ...@@ -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 // StdinName is the name set for files which don specify FilePath as
// os.Stdin.Name() // os.Stdin.Name()
func (unixfsOpts) StdinName(name string) UnixfsAddOption { func (unixfsOpts) StdinName(name string) UnixfsAddOption {
......
...@@ -328,7 +328,7 @@ func (tp *provider) TestAdd(t *testing.T) { ...@@ -328,7 +328,7 @@ func (tp *provider) TestAdd(t *testing.T) {
}, },
// hidden // hidden
{ {
name: "hiddenFiles", name: "hiddenFilesAdded",
data: func() files.Node { data: func() files.Node {
return files.NewMapDirectory(map[string]files.Node{ return files.NewMapDirectory(map[string]files.Node{
".bar": files.NewBytesFile([]byte("hello2")), ".bar": files.NewBytesFile([]byte("hello2")),
...@@ -339,48 +339,6 @@ func (tp *provider) TestAdd(t *testing.T) { ...@@ -339,48 +339,6 @@ func (tp *provider) TestAdd(t *testing.T) {
wrap: "t", wrap: "t",
expect: wrapped("t"), expect: wrapped("t"),
path: "/ipfs/QmPXLSBX382vJDLrGakcbrZDkU3grfkjMox7EgSC9KFbtQ", 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 // 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