1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 00:07:25 +00:00

ls: fix broken folder if --ncdu an file filters are combined

This commit is contained in:
Michael Eischer 2024-07-07 13:08:41 +02:00
parent be98402ac6
commit 894ec9d05d

View file

@ -367,9 +367,11 @@ func runLs(ctx context.Context, opts LsOptions, gopts GlobalOptions, args []stri
return nil return nil
} }
printedDir := false
if withinDir(nodepath) { if withinDir(nodepath) {
// if we're within a dir, print the node // if we're within a dir, print the node
printer.Node(nodepath, node) printer.Node(nodepath, node)
printedDir = true
// if recursive listing is requested, signal the walker that it // if recursive listing is requested, signal the walker that it
// should continue walking recursively // should continue walking recursively
@ -387,6 +389,9 @@ func runLs(ctx context.Context, opts LsOptions, gopts GlobalOptions, args []stri
// otherwise, signal the walker to not walk recursively into any // otherwise, signal the walker to not walk recursively into any
// subdirs // subdirs
if node.Type == "dir" { if node.Type == "dir" {
if printedDir {
printer.LeaveDir(nodepath)
}
return walker.ErrSkipNode return walker.ErrSkipNode
} }
return nil return nil