reimplementing depth feature

This commit is contained in:
zricethezav committed 2020-01-19 12:14:14 -05:00
1 parent b47e00858e
commit f6460a7365
5 files changed
+143 -2

No files matched your search

+10 -1
View File
@@ -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
}