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-dms3
Commits
fd1cd995
Commit
fd1cd995
authored
Nov 04, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore add.go from master
parent
283c175f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
core/commands/add.go
core/commands/add.go
+4
-8
No files found.
core/commands/add.go
View file @
fd1cd995
...
...
@@ -10,11 +10,9 @@ import (
"github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/importer"
"github.com/jbenet/go-ipfs/importer/chunk"
dag
"github.com/jbenet/go-ipfs/merkledag"
"github.com/jbenet/go-ipfs/pin"
ft
"github.com/jbenet/go-ipfs/unixfs"
uio
"github.com/jbenet/go-ipfs/unixfs/io"
)
// Error indicating the max depth has been exceded.
...
...
@@ -84,28 +82,26 @@ func addDir(n *core.IpfsNode, fpath string, depth int, out io.Writer) (*dag.Node
}
}
log
.
Info
(
"adding dir: %s"
,
fpath
)
log
.
Info
f
(
"adding dir: %s"
,
fpath
)
return
tree
,
addNode
(
n
,
tree
,
fpath
,
out
)
}
func
addFile
(
n
*
core
.
IpfsNode
,
fpath
string
,
depth
int
,
out
io
.
Writer
)
(
*
dag
.
Node
,
error
)
{
dw
:=
uio
.
NewDagWriter
(
n
.
DAG
,
chunk
.
DefaultSplitter
)
mp
,
ok
:=
n
.
Pinning
.
(
pin
.
ManualPinner
)
if
!
ok
{
return
nil
,
errors
.
New
(
"invalid pinner type! expected manual pinner"
)
}
dw
.
Pinner
=
mp
root
,
err
:=
importer
.
ImportF
il
e
Dag
(
fpath
,
dw
)
root
,
err
:=
importer
.
Bu
il
d
Dag
FromFile
(
fpath
,
n
.
DAG
,
mp
)
if
err
!=
nil
{
return
nil
,
err
}
log
.
Info
(
"adding file: %s"
,
fpath
)
log
.
Info
f
(
"adding file: %s"
,
fpath
)
for
_
,
l
:=
range
root
.
Links
{
log
.
Info
(
"adding subblock: %s %s"
,
l
.
Name
,
l
.
Hash
.
B58String
())
log
.
Info
f
(
"adding subblock:
'
%s
'
%s"
,
l
.
Name
,
l
.
Hash
.
B58String
())
}
k
,
err
:=
root
.
Key
()
...
...
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