Skip to content

Commit aa6fba2

Browse files
committed
fix(walker): fix off-by-one error in max depth logic
Signed-off-by: ShigrafS <shigrafsalik@proton.me>
1 parent b1f453b commit aa6fba2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utils/walker/git.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ func (g *Git) MaxFileSize(size int64) *Git {
6868
}
6969

7070
func (g *Git) MaxDepth(depth int) *Git {
71-
g.maxDepth = depth
72-
return g
71+
g.maxDepth = depth
72+
return g
7373
}
7474

7575
// ShowLogs enable the logs and returns a pointer
@@ -202,7 +202,7 @@ func clonewalk(g *Git) error {
202202
// Check max depth if configured
203203
if g.maxDepth > 0 {
204204
currentDepth := strings.Count(path, pathSep) - rootDepth
205-
if currentDepth >= g.maxDepth {
205+
if currentDepth > g.maxDepth {
206206
return filepath.SkipDir
207207
}
208208
}

0 commit comments

Comments
 (0)