mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
fixing commit counts (#342)
* fixing commit counts * fixing commit to test
This commit is contained in:
1 parent
ee2d73c740
commit
10745be661
3 files changed
+31
-2
No files matched your search
+4
-2
@@ -257,8 +257,7 @@ func (repo *Repo) Audit() error {
|
|||||||
semaphore := make(chan bool, howManyThreads(repo.Manager.Opts.Threads))
|
semaphore := make(chan bool, howManyThreads(repo.Manager.Opts.Threads))
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
err = cIter.ForEach(func(c *object.Commit) error {
|
err = cIter.ForEach(func(c *object.Commit) error {
|
||||||
if c == nil || c.Hash.String() == repo.Manager.Opts.CommitTo ||
|
if c == nil || repo.timeoutReached() || repo.depthReached(cc) {
|
||||||
repo.timeoutReached() || repo.depthReached(cc) {
|
|
||||||
return storer.ErrStop
|
return storer.ErrStop
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,6 +305,9 @@ func (repo *Repo) Audit() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
if c.Hash.String() == repo.Manager.Opts.CommitTo {
|
||||||
|
return storer.ErrStop
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ type commitInspector func(c *object.Commit, repo *Repo) error
|
|||||||
// object will be created from the hash which will be passed into either inspectCommitPatches
|
// object will be created from the hash which will be passed into either inspectCommitPatches
|
||||||
// or inspectFilesAtCommit depending on the options set.
|
// or inspectFilesAtCommit depending on the options set.
|
||||||
func inspectCommit(hash string, repo *Repo, f commitInspector) error {
|
func inspectCommit(hash string, repo *Repo, f commitInspector) error {
|
||||||
|
repo.Manager.IncrementCommits(1)
|
||||||
h := plumbing.NewHash(hash)
|
h := plumbing.NewHash(hash)
|
||||||
c, err := repo.CommitObject(h)
|
c, err := repo.CommitObject(h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -50,5 +50,31 @@
|
|||||||
"file": "secrets.md",
|
"file": "secrets.md",
|
||||||
"date": "2019-10-25T13:12:08-04:00",
|
"date": "2019-10-25T13:12:08-04:00",
|
||||||
"tags": "key, API, generic"
|
"tags": "key, API, generic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "AKIALALEMEL33243OLIA",
|
||||||
|
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "AWS Manager ID",
|
||||||
|
"commitMessage": "committing pem\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
|
"tags": "key, AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"offender": "secret: \"AKIALALEMEL33243OLIAE\"",
|
||||||
|
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
|
||||||
|
"repo": "test_repo_2",
|
||||||
|
"rule": "Generic Credential",
|
||||||
|
"commitMessage": "committing pem\n",
|
||||||
|
"author": "zach rice",
|
||||||
|
"email": "zricer@protonmail.com",
|
||||||
|
"file": "secrets.md",
|
||||||
|
"date": "2019-10-25T13:07:41-04:00",
|
||||||
|
"tags": "key, API, generic"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in new issue
Block a user