Skip to content

Commit a12df0f

Browse files
author
Emmanuel Odeke
committed
stat: respect traversal depth
1 parent 790db71 commit a12df0f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/stat.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ func prettyFileStat(logf log.Loggerf, relToRootPath string, file *File) {
131131
}
132132

133133
func (g *Commands) stat(relToRootPath string, file *File, depth int) error {
134+
if depth == 0 {
135+
return nil
136+
}
134137

135138
if g.opts.Md5sum {
136139
if file.Md5Checksum != "" {
@@ -148,7 +151,7 @@ func (g *Commands) stat(relToRootPath string, file *File, depth int) error {
148151
}
149152
}
150153

151-
if depth == 0 || !file.IsDir {
154+
if !file.IsDir {
152155
return nil
153156
}
154157

0 commit comments

Comments
 (0)