Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ type SimpleFileInfo struct {
End int64
}

type SimplestFileInfo struct {
Path string
}

// file system tree node
type fsNode struct {
Name string
Expand Down Expand Up @@ -322,18 +326,21 @@ func buildIpldGraph(ctx context.Context,
// }
// log.Info(dirNodeMap)

fileInfo, err := json.Marshal(sfis)
var infos []SimplestFileInfo
for _, info := range sfis {
infos = append(infos, SimplestFileInfo{
Path: info.Path,
})
}

fileInfo, err := json.Marshal(infos)
if err != nil {
return nil, "", "", err
}
log.Info("++++++++++++ finished to build ipld +++++++++++++")

if skipFilename {
type path struct {
Path string `json:"path"`
}

var list []path
var list []SimplestFileInfo
seen := make(map[string]struct{})
for _, f := range sfis {
dir := filepath.Dir(f.Path)
Expand All @@ -342,7 +349,7 @@ func buildIpldGraph(ctx context.Context,
}
if _, ok := seen[dir]; !ok {
seen[dir] = struct{}{}
list = append(list, path{Path: dir})
list = append(list, SimplestFileInfo{Path: dir})
}
}

Expand Down