Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
56944d64
Commit
56944d64
authored
Mar 10, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unixfs add: Remove hidden file handling
parent
e87318a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
64 deletions
+1
-64
options/unixfs.go
options/unixfs.go
+0
-21
tests/unixfs.go
tests/unixfs.go
+1
-43
No files found.
options/unixfs.go
View file @
56944d64
...
@@ -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
{
...
...
tests/unixfs.go
View file @
56944d64
...
@@ -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
:
"hiddenFiles
Added
"
,
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
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment