From 7e34de4c29451dbd883f43d00be9856ebf92a88c Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 12 Aug 2018 22:18:44 +0200 Subject: [PATCH] ls: Add comments --- cmd/restic/cmd_ls.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/restic/cmd_ls.go b/cmd/restic/cmd_ls.go index b49cb01f0..1fb08c7a2 100644 --- a/cmd/restic/cmd_ls.go +++ b/cmd/restic/cmd_ls.go @@ -106,7 +106,17 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error { // are not in matching trees or will not lead us to matching trees var walk bool for _, dir := range dirs { + + // the current node path is a prefix for one of the + // directories, so we're interested in something deeper in the + // tree. Example: + // nodepath: "/test" + // dir: "/test/foo" approachingMatchingTree := fs.HasPathPrefix(nodepath, dir) + + // we're within one of the selected dirs, example: + // nodepath: "/test/foo" + // dir: "/test" inMatchingTree := fs.HasPathPrefix(dir, nodepath) // this condition is complex, but it basically requires that we