mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03c53d2978 | ||
|
|
695449d73d | ||
|
|
6bad1e7194 | ||
|
|
77dec1461b | ||
|
|
14d77f59d4 | ||
|
|
afb598cf15 | ||
|
|
b4c6fe92e0 | ||
|
|
f50577be1c | ||
|
|
c358ae9310 | ||
|
|
9554258d02 | ||
|
|
95ee2cc30e | ||
|
|
79a35f0c27 | ||
|
|
7a021cda9e | ||
|
|
447f7a04cb | ||
|
|
e5b62cbc7c | ||
|
|
6739a34f74 | ||
|
|
e502bf29de | ||
|
|
51b504bf99 |
No files matched your search
@@ -1,6 +1,18 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
1.18.0
|
||||||
|
----
|
||||||
|
- fixing slack token
|
||||||
|
- defaulting to single thread process
|
||||||
|
- `--max-go=` --> `--threads=`
|
||||||
|
- guarding `--threads=` > max threads available (you aint gettin any more performance)
|
||||||
|
|
||||||
|
1.17.0
|
||||||
|
----
|
||||||
|
- Default regex added to search: slack, telegram.
|
||||||
|
- Default whitelisting: bin, doc, jpeg, gif
|
||||||
|
|
||||||
1.16.1
|
1.16.1
|
||||||
----
|
----
|
||||||
- Fixing default ssh auth logic
|
- Fixing default ssh auth logic
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ Application Options:
|
|||||||
--depth= maximum commit depth
|
--depth= maximum commit depth
|
||||||
--repo-path= Path to repo
|
--repo-path= Path to repo
|
||||||
--owner-path= Path to owner directory (repos discovered)
|
--owner-path= Path to owner directory (repos discovered)
|
||||||
--max-go= Maximum number of concurrent go-routines gitleaks spawns
|
--threads= Maximum number of threads gitleaks spawns
|
||||||
--disk Clones repo(s) to disk
|
--disk Clones repo(s) to disk
|
||||||
--all-refs run audit on all refs
|
--all-refs run audit on all refs
|
||||||
--single-search= single regular expression to search for
|
--single-search= single regular expression to search for
|
||||||
|
|||||||
@@ -143,12 +143,8 @@ func auditGithubRepos() ([]Leak, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if opts.Disk {
|
if opts.Disk {
|
||||||
ownerDir, err = ioutil.TempDir(dir, opts.GithubUser)
|
ownerDir, _ = ioutil.TempDir(dir, opts.GithubUser)
|
||||||
os.RemoveAll(ownerDir)
|
|
||||||
}
|
}
|
||||||
for _, githubRepo := range githubRepos {
|
for _, githubRepo := range githubRepos {
|
||||||
repo, err := cloneGithubRepo(githubRepo)
|
repo, err := cloneGithubRepo(githubRepo)
|
||||||
|
|||||||
@@ -20,6 +20,15 @@ regex = '''(?i)facebook.*['\"][0-9a-f]{32}['\"]'''
|
|||||||
[[regexes]]
|
[[regexes]]
|
||||||
description = "Twitter"
|
description = "Twitter"
|
||||||
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
||||||
|
[[regexes]]
|
||||||
|
description = "Telegram"
|
||||||
|
regex = '''(?i)telegram.*['\"][0-9]{1,12}+:[0-9a-zA-Z-]{32,44}['\"]'''
|
||||||
|
[[regexes]]
|
||||||
|
description = "PGP"
|
||||||
|
regex = '''-----BEGIN PGP PRIVATE KEY BLOCK-----'''
|
||||||
|
[[regexes]]
|
||||||
|
description = "Slack token"
|
||||||
|
regex = '''xox[baprs]-.*'''
|
||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
regexes = [
|
regexes = [
|
||||||
|
|||||||
+15
-15
@@ -504,7 +504,7 @@ func TestAuditRepo(t *testing.T) {
|
|||||||
description: "two leaks present limit goroutines",
|
description: "two leaks present limit goroutines",
|
||||||
numLeaks: 2,
|
numLeaks: 2,
|
||||||
testOpts: Options{
|
testOpts: Options{
|
||||||
MaxGoRoutines: 4,
|
Threads: 4,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -898,7 +898,7 @@ func TestLoadToml(t *testing.T) {
|
|||||||
|
|
||||||
func BenchmarkAuditRepo1Proc(b *testing.B) {
|
func BenchmarkAuditRepo1Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 1
|
opts.Threads = 1
|
||||||
benchmarkRepo = getBenchmarkRepo()
|
benchmarkRepo = getBenchmarkRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -907,7 +907,7 @@ func BenchmarkAuditRepo1Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditRepo2Proc(b *testing.B) {
|
func BenchmarkAuditRepo2Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 2
|
opts.Threads = 2
|
||||||
benchmarkRepo = getBenchmarkRepo()
|
benchmarkRepo = getBenchmarkRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -916,7 +916,7 @@ func BenchmarkAuditRepo2Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditRepo4Proc(b *testing.B) {
|
func BenchmarkAuditRepo4Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 4
|
opts.Threads = 4
|
||||||
benchmarkRepo = getBenchmarkRepo()
|
benchmarkRepo = getBenchmarkRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -925,7 +925,7 @@ func BenchmarkAuditRepo4Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditRepo8Proc(b *testing.B) {
|
func BenchmarkAuditRepo8Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 8
|
opts.Threads = 8
|
||||||
benchmarkRepo = getBenchmarkRepo()
|
benchmarkRepo = getBenchmarkRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -934,7 +934,7 @@ func BenchmarkAuditRepo8Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditRepo10Proc(b *testing.B) {
|
func BenchmarkAuditRepo10Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 10
|
opts.Threads = 10
|
||||||
benchmarkRepo = getBenchmarkRepo()
|
benchmarkRepo = getBenchmarkRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -943,7 +943,7 @@ func BenchmarkAuditRepo10Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditRepo100Proc(b *testing.B) {
|
func BenchmarkAuditRepo100Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 100
|
opts.Threads = 100
|
||||||
benchmarkRepo = getBenchmarkRepo()
|
benchmarkRepo = getBenchmarkRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -952,7 +952,7 @@ func BenchmarkAuditRepo100Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditRepo1000Proc(b *testing.B) {
|
func BenchmarkAuditRepo1000Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 1000
|
opts.Threads = 1000
|
||||||
benchmarkRepo = getBenchmarkRepo()
|
benchmarkRepo = getBenchmarkRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -960,7 +960,7 @@ func BenchmarkAuditRepo1000Proc(b *testing.B) {
|
|||||||
}
|
}
|
||||||
func BenchmarkAuditLeakRepo1Proc(b *testing.B) {
|
func BenchmarkAuditLeakRepo1Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 1
|
opts.Threads = 1
|
||||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -969,7 +969,7 @@ func BenchmarkAuditLeakRepo1Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditLeakRepo2Proc(b *testing.B) {
|
func BenchmarkAuditLeakRepo2Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 2
|
opts.Threads = 2
|
||||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -978,7 +978,7 @@ func BenchmarkAuditLeakRepo2Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditLeakRepo4Proc(b *testing.B) {
|
func BenchmarkAuditLeakRepo4Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 4
|
opts.Threads = 4
|
||||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -987,7 +987,7 @@ func BenchmarkAuditLeakRepo4Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditLeakRepo8Proc(b *testing.B) {
|
func BenchmarkAuditLeakRepo8Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 8
|
opts.Threads = 8
|
||||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -996,7 +996,7 @@ func BenchmarkAuditLeakRepo8Proc(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkAuditLeakRepo10Proc(b *testing.B) {
|
func BenchmarkAuditLeakRepo10Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 10
|
opts.Threads = 10
|
||||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -1004,7 +1004,7 @@ func BenchmarkAuditLeakRepo10Proc(b *testing.B) {
|
|||||||
}
|
}
|
||||||
func BenchmarkAuditLeakRepo100Proc(b *testing.B) {
|
func BenchmarkAuditLeakRepo100Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 100
|
opts.Threads = 100
|
||||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
@@ -1012,7 +1012,7 @@ func BenchmarkAuditLeakRepo100Proc(b *testing.B) {
|
|||||||
}
|
}
|
||||||
func BenchmarkAuditLeakRepo1000Proc(b *testing.B) {
|
func BenchmarkAuditLeakRepo1000Proc(b *testing.B) {
|
||||||
loadToml()
|
loadToml()
|
||||||
opts.MaxGoRoutines = 1000
|
opts.Threads = 1000
|
||||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
auditGitRepo(benchmarkRepo)
|
auditGitRepo(benchmarkRepo)
|
||||||
|
|||||||
@@ -81,14 +81,14 @@ type Options struct {
|
|||||||
OwnerPath string `long:"owner-path" description:"Path to owner directory (repos discovered)"`
|
OwnerPath string `long:"owner-path" description:"Path to owner directory (repos discovered)"`
|
||||||
|
|
||||||
// Process options
|
// Process options
|
||||||
MaxGoRoutines int `long:"max-go" description:"Maximum number of concurrent go-routines gitleaks spawns"`
|
Threads int `long:"threads" description:"Maximum number of threads gitleaks spawns"`
|
||||||
Disk bool `long:"disk" description:"Clones repo(s) to disk"`
|
Disk bool `long:"disk" description:"Clones repo(s) to disk"`
|
||||||
AuditAllRefs bool `long:"all-refs" description:"run audit on all refs"`
|
AuditAllRefs bool `long:"all-refs" description:"run audit on all refs"`
|
||||||
SingleSearch string `long:"single-search" description:"single regular expression to search for"`
|
SingleSearch string `long:"single-search" description:"single regular expression to search for"`
|
||||||
ConfigPath string `long:"config" description:"path to gitleaks config"`
|
ConfigPath string `long:"config" description:"path to gitleaks config"`
|
||||||
SSHKey string `long:"ssh-key" description:"path to ssh key"`
|
SSHKey string `long:"ssh-key" description:"path to ssh key"`
|
||||||
ExcludeForks bool `long:"exclude-forks" description:"exclude forks for organization/user audits"`
|
ExcludeForks bool `long:"exclude-forks" description:"exclude forks for organization/user audits"`
|
||||||
Entropy float64 `long:"entropy" short:"e" description:"Include entropy checks during audit. Entropy scale: 0.0(no entropy) - 8.0(max entropy)"`
|
Entropy float64 `long:"entropy" short:"e" description:"Include entropy checks during audit. Entropy scale: 0.0(no entropy) - 8.0(max entropy)"`
|
||||||
// TODO: IncludeMessages string `long:"messages" description:"include commit messages in audit"`
|
// TODO: IncludeMessages string `long:"messages" description:"include commit messages in audit"`
|
||||||
|
|
||||||
// Output options
|
// Output options
|
||||||
@@ -136,7 +136,7 @@ type entropyRange struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultGithubURL = "https://api.github.com/"
|
const defaultGithubURL = "https://api.github.com/"
|
||||||
const version = "1.16.1"
|
const version = "1.18.0"
|
||||||
const errExit = 2
|
const errExit = 2
|
||||||
const leakExit = 1
|
const leakExit = 1
|
||||||
const defaultConfig = `
|
const defaultConfig = `
|
||||||
@@ -145,53 +145,61 @@ const defaultConfig = `
|
|||||||
# is set, gitleaks will load configurations from that path. If option --config-path is set, gitleaks will load
|
# is set, gitleaks will load configurations from that path. If option --config-path is set, gitleaks will load
|
||||||
# configurations from that path. Gitleaks does not whitelist anything by default.
|
# configurations from that path. Gitleaks does not whitelist anything by default.
|
||||||
|
|
||||||
|
|
||||||
title = "gitleaks config"
|
title = "gitleaks config"
|
||||||
# add regexes to the regex table
|
# add regexes to the regex table
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
description = "AWS"
|
description = "AWS"
|
||||||
regex = '''AKIA[0-9A-Z]{16}'''
|
regex = '''AKIA[0-9A-Z]{16}'''
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
description = "RKCS8"
|
description = "PKCS8"
|
||||||
regex = '''-----BEGIN PRIVATE KEY-----'''
|
regex = '''-----BEGIN PRIVATE KEY-----'''
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
description = "RSA"
|
description = "RSA"
|
||||||
regex = '''-----BEGIN RSA PRIVATE KEY-----'''
|
regex = '''-----BEGIN RSA PRIVATE KEY-----'''
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
description = "Github"
|
|
||||||
regex = '''(?i)github.*['\"][0-9a-zA-Z]{35,40}['\"]'''
|
|
||||||
[[regexes]]
|
|
||||||
description = "SSH"
|
description = "SSH"
|
||||||
regex = '''-----BEGIN OPENSSH PRIVATE KEY-----'''
|
regex = '''-----BEGIN OPENSSH PRIVATE KEY-----'''
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
|
description = "PGP"
|
||||||
|
regex = '''-----BEGIN PGP PRIVATE KEY BLOCK-----'''
|
||||||
|
[[regexes]]
|
||||||
description = "Facebook"
|
description = "Facebook"
|
||||||
regex = '''(?i)facebook.*['\"][0-9a-f]{32}['\"]'''
|
regex = '''(?i)facebook.*['\"][0-9a-f]{32}['\"]'''
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
description = "Twitter"
|
description = "Twitter"
|
||||||
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
||||||
|
[[regexes]]
|
||||||
|
description = "Github"
|
||||||
|
regex = '''(?i)github.*['\"][0-9a-zA-Z]{35,40}['\"]'''
|
||||||
|
[[regexes]]
|
||||||
|
description = "Slack"
|
||||||
|
regex = '''xox[baprs]-.*'''
|
||||||
|
[[regexes]]
|
||||||
|
description = "Telegram"
|
||||||
|
regex = '''\d{5,}:A[a-zA-Z0-9_\-]{34,34}'''
|
||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
#regexes = [
|
regexes = [
|
||||||
# "AKAIMYFAKEAWKKEY",
|
'''(?i)github.*ref.*['\"][0-9a-fA-F]{35,40}['\"]''',
|
||||||
#]
|
'''(?i)shasum.*['\"][0-9a-fA-F]{40}['\"]''',
|
||||||
|
'''(?i)githead.*['\"][0-9a-fA-F]{40}['\"]''',
|
||||||
#files = [
|
'''(?i)email_hash.*['\"][0-9a-fA-F]{40}['\"]''',
|
||||||
# "(.*?)(jpg|gif|doc|pdf|bin)$"
|
'''(?i)email_hash.*['\"][0-9a-fA-F]{32}['\"]''',
|
||||||
#]
|
'''(?i)rev.*:.*['\"][0-9a-fA-F]{40}['\"]''',
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
"(.*?)(jpg|gif|doc|pdf|bin)$"
|
||||||
|
]
|
||||||
#commits = [
|
#commits = [
|
||||||
# "BADHA5H1",
|
# "BADHA5H1",
|
||||||
# "BADHA5H2",
|
# "BADHA5H2",
|
||||||
#]
|
#]
|
||||||
|
|
||||||
#branches = [
|
#branches = [
|
||||||
# "dev/goodrepo"
|
# "dev/goodrepo"
|
||||||
#]
|
#]
|
||||||
|
|
||||||
#repos = [
|
#repos = [
|
||||||
# "mygoodrepo"
|
# "mygoodrepo"
|
||||||
#]
|
#]
|
||||||
|
|
||||||
[misc]
|
[misc]
|
||||||
#entropy = [
|
#entropy = [
|
||||||
# "3.3-4.30"
|
# "3.3-4.30"
|
||||||
@@ -212,13 +220,14 @@ var (
|
|||||||
fileDiffRegex *regexp.Regexp
|
fileDiffRegex *regexp.Regexp
|
||||||
sshAuth *ssh.PublicKeys
|
sshAuth *ssh.PublicKeys
|
||||||
dir string
|
dir string
|
||||||
maxGo int
|
threads int
|
||||||
totalCommits int64
|
totalCommits int64
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log.SetOutput(os.Stdout)
|
log.SetOutput(os.Stdout)
|
||||||
maxGo = runtime.GOMAXPROCS(0) / 2
|
// threads = runtime.GOMAXPROCS(0) / 2
|
||||||
|
threads = 1
|
||||||
regexes = make(map[string]*regexp.Regexp)
|
regexes = make(map[string]*regexp.Regexp)
|
||||||
whiteListCommits = make(map[string]bool)
|
whiteListCommits = make(map[string]bool)
|
||||||
}
|
}
|
||||||
@@ -479,13 +488,13 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
|||||||
semaphore chan bool
|
semaphore chan bool
|
||||||
)
|
)
|
||||||
repoName = repo.name
|
repoName = repo.name
|
||||||
if opts.MaxGoRoutines != 0 {
|
if opts.Threads != 0 {
|
||||||
maxGo = opts.MaxGoRoutines
|
threads = opts.Threads
|
||||||
}
|
}
|
||||||
if opts.RepoPath != "" {
|
if opts.RepoPath != "" {
|
||||||
maxGo = 1
|
threads = 1
|
||||||
}
|
}
|
||||||
semaphore = make(chan bool, maxGo)
|
semaphore = make(chan bool, threads)
|
||||||
|
|
||||||
cIter, err := repo.repository.Log(&git.LogOptions{From: ref.Hash()})
|
cIter, err := repo.repository.Log(&git.LogOptions{From: ref.Hash()})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -732,6 +741,10 @@ func optsGuard() error {
|
|||||||
return fmt.Errorf("github user set and local owner path")
|
return fmt.Errorf("github user set and local owner path")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opts.Threads > runtime.GOMAXPROCS(0) {
|
||||||
|
return fmt.Errorf("%d available threads", runtime.GOMAXPROCS(0))
|
||||||
|
}
|
||||||
|
|
||||||
// do the URL Parse and error checking here, so we can skip it later
|
// do the URL Parse and error checking here, so we can skip it later
|
||||||
// empty string is OK, it will default to the public github URL.
|
// empty string is OK, it will default to the public github URL.
|
||||||
if opts.GithubURL != "" && opts.GithubURL != defaultGithubURL {
|
if opts.GithubURL != "" && opts.GithubURL != defaultGithubURL {
|
||||||
|
|||||||
Reference in new issue
Block a user