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
5770bf8d
Unverified
Commit
5770bf8d
authored
Mar 29, 2018
by
Whyrusleeping
Committed by
GitHub
Mar 29, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4890 from ipfs/feat/fast-ls
infer type from CID when possible in ls command
parents
3f6519b4
3b0e16e3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
core/commands/ls.go
core/commands/ls.go
+19
-13
No files found.
core/commands/ls.go
View file @
5770bf8d
...
...
@@ -18,6 +18,7 @@ import (
uio
"github.com/ipfs/go-ipfs/unixfs/io"
unixfspb
"github.com/ipfs/go-ipfs/unixfs/pb"
cid
"gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
"gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit"
ipld
"gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"
)
...
...
@@ -134,6 +135,11 @@ The JSON output contains type information.
for
j
,
link
:=
range
links
{
t
:=
unixfspb
.
Data_DataType
(
-
1
)
switch
link
.
Cid
.
Type
()
{
case
cid
.
Raw
:
// No need to check with raw leaves
t
=
unixfspb
.
Data_File
case
cid
.
DagProtobuf
:
linkNode
,
err
:=
link
.
GetNode
(
req
.
Context
(),
dserv
)
if
err
==
ipld
.
ErrNotFound
&&
!
resolve
{
// not an error
...
...
@@ -149,9 +155,9 @@ The JSON output contains type information.
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
t
=
d
.
GetType
()
}
}
output
[
i
]
.
Links
[
j
]
=
LsLink
{
Name
:
link
.
Name
,
Hash
:
link
.
Cid
.
String
(),
...
...
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