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
go-ds-flatfs
Commits
96522942
Commit
96522942
authored
Dec 07, 2016
by
Jeromy Johnson
Committed by
GitHub
Dec 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7 from ipfs/kevina/non-file-ignore
Ignore non-directories in the top level directory.
parents
3567e098
7ec19f16
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
flatfs.go
flatfs.go
+11
-1
flatfs_test.go
flatfs_test.go
+5
-0
No files found.
flatfs.go
View file @
96522942
...
@@ -320,7 +320,7 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) {
...
@@ -320,7 +320,7 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) {
defer
close
(
reschan
)
defer
close
(
reschan
)
err
:=
fs
.
walkTopLevel
(
fs
.
path
,
reschan
)
err
:=
fs
.
walkTopLevel
(
fs
.
path
,
reschan
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Warning
(
"walk failed: "
,
err
)
reschan
<-
query
.
Result
{
Error
:
errors
.
New
(
"walk failed: "
+
err
.
Error
())}
}
}
}()
}()
return
query
.
ResultsWithChan
(
q
,
reschan
),
nil
return
query
.
ResultsWithChan
(
q
,
reschan
),
nil
...
@@ -357,6 +357,16 @@ func (fs *Datastore) walk(path string, reschan chan query.Result) error {
...
@@ -357,6 +357,16 @@ func (fs *Datastore) walk(path string, reschan chan query.Result) error {
return
err
return
err
}
}
defer
dir
.
Close
()
defer
dir
.
Close
()
// ignore non-directories
fileInfo
,
err
:=
dir
.
Stat
()
if
err
!=
nil
{
return
err
}
if
!
fileInfo
.
IsDir
()
{
return
nil
}
names
,
err
:=
dir
.
Readdirnames
(
-
1
)
names
,
err
:=
dir
.
Readdirnames
(
-
1
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
flatfs_test.go
View file @
96522942
...
@@ -343,6 +343,11 @@ func testQuerySimple(dirFunc mkShardFunc, t *testing.T) {
...
@@ -343,6 +343,11 @@ func testQuerySimple(dirFunc mkShardFunc, t *testing.T) {
temp
,
cleanup
:=
tempdir
(
t
)
temp
,
cleanup
:=
tempdir
(
t
)
defer
cleanup
()
defer
cleanup
()
err
:=
ioutil
.
WriteFile
(
filepath
.
Join
(
temp
,
"README"
),
[]
byte
(
"something"
),
0666
)
if
err
!=
nil
{
t
.
Fatalf
(
"WriteFile fail: %v
\n
"
,
err
)
}
fs
,
err
:=
flatfs
.
New
(
temp
,
dirFunc
(
2
),
false
)
fs
,
err
:=
flatfs
.
New
(
temp
,
dirFunc
(
2
),
false
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"New fail: %v
\n
"
,
err
)
t
.
Fatalf
(
"New fail: %v
\n
"
,
err
)
...
...
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