mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 21:24:21 +01:00
Merge pull request #108 from camaya/fix-commit-option
Fix commit option
This commit is contained in:
2 files changed
+10
No files matched your search
@@ -560,6 +560,14 @@ func TestAuditRepo(t *testing.T) {
|
|||||||
numLeaks: 0,
|
numLeaks: 0,
|
||||||
configPath: path.Join(configsDir, "repo"),
|
configPath: path.Join(configsDir, "repo"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
repo: leaksRepo,
|
||||||
|
description: "Audit until specific commit",
|
||||||
|
numLeaks: 1,
|
||||||
|
testOpts: Options{
|
||||||
|
Commit: "f6839959b7bbdcd23008f1fb16f797f35bcd3a0c",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
whiteListCommits = make(map[string]bool)
|
whiteListCommits = make(map[string]bool)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
@@ -450,6 +451,7 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
|||||||
err = cIter.ForEach(func(c *object.Commit) error {
|
err = cIter.ForEach(func(c *object.Commit) error {
|
||||||
if c.Hash.String() == opts.Commit {
|
if c.Hash.String() == opts.Commit {
|
||||||
cIter.Close()
|
cIter.Close()
|
||||||
|
return errors.New("ErrStop")
|
||||||
}
|
}
|
||||||
if whiteListCommits[c.Hash.String()] {
|
if whiteListCommits[c.Hash.String()] {
|
||||||
log.Infof("skipping commit: %s\n", c.Hash.String())
|
log.Infof("skipping commit: %s\n", c.Hash.String())
|
||||||
|
|||||||
Reference in new issue
Block a user