mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 21:44:23 +01:00
reimplementing depth feature
This commit is contained in:
1 parent
b47e00858e
commit
f6460a7365
5 files changed
+143
-2
No files matched your search
+10
-1
@@ -261,7 +261,8 @@ func (repo *Repo) Audit() error {
|
||||
semaphore := make(chan bool, howManyThreads(repo.Manager.Opts.Threads))
|
||||
wg := sync.WaitGroup{}
|
||||
err = cIter.ForEach(func(c *object.Commit) error {
|
||||
if c == nil || c.Hash.String() == repo.Manager.Opts.CommitTo || repo.timeoutReached() {
|
||||
if c == nil || c.Hash.String() == repo.Manager.Opts.CommitTo ||
|
||||
repo.timeoutReached() || repo.depthReached(cc) {
|
||||
return storer.ErrStop
|
||||
}
|
||||
|
||||
@@ -392,3 +393,11 @@ func (repo *Repo) setupTimeout() error {
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (repo *Repo) depthReached(i int) bool {
|
||||
if repo.Manager.Opts.Depth != 0 && repo.Manager.Opts.Depth == i {
|
||||
log.Warnf("Exceeded depth limit (%d)", i)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in new issue
Block a user