Skip to content

Commit

Permalink
Remove unnecessary caching and add mfs test.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
  • Loading branch information
hackergrrl committed Jun 1, 2016
1 parent e0fb560 commit af57caf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
11 changes: 0 additions & 11 deletions mfs/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,6 @@ func (d *Directory) AddChild(name string, nd *dag.Node) error {

d.modTime = time.Now()

if len(nd.Links) == 0 {
nfi, err := NewFile(name, nd, d, d.dserv)
if err != nil {
return err
}
d.files[name] = nfi
} else {
ndir := NewDirectory(d.ctx, name, nd, d, d.dserv)
d.childDirs[name] = ndir
}

return nil
}

Expand Down
19 changes: 19 additions & 0 deletions test/sharness/t0250-files-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,25 @@ test_files_api() {
test_expect_success "child dir looks right" '
verify_dir_contents /
'

# test for https://github.com/ipfs/go-ipfs/issues/2654
test_expect_success "create and remove dir" '
ipfs files mkdir /test_dir &&
ipfs files rm -r "/test_dir"
'
test_expect_success "create test file" '
echo "content" | ipfs files write -e "/test_file"
'
test_expect_success "copy test file onto test dir" '
ipfs files cp "/test_file" "/test_dir"
'
test_expect_success "test /test_dir" '
ipfs files stat "/test_dir" | grep -q "^Type: file"
'
test_expect_success "clean up /test_dir and /test_file" '
ipfs files rm -r /test_dir &&
ipfs files rm -r /test_file
'
}

# test offline and online
Expand Down

0 comments on commit af57caf

Please sign in to comment.