mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
Fixed failure when Branch option is ommited
This commit is contained in:
1 parent
a7ccb7a9d1
commit
d99588fe19
1 file changed
+2
@@ -445,6 +445,7 @@ func auditRepo(r *git.Repository) ([]Leak, error) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
if opts.Branch != "" {
|
||||||
foundBranch := false
|
foundBranch := false
|
||||||
refs, _ := r.Storer.IterReferences()
|
refs, _ := r.Storer.IterReferences()
|
||||||
branch := strings.Split(opts.Branch, "/")[len(strings.Split(opts.Branch, "/"))-1]
|
branch := strings.Split(opts.Branch, "/")[len(strings.Split(opts.Branch, "/"))-1]
|
||||||
@@ -459,6 +460,7 @@ func auditRepo(r *git.Repository) ([]Leak, error) {
|
|||||||
log.Fatalf("No branch with name", opts.Branch)
|
log.Fatalf("No branch with name", opts.Branch)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
auditRef(r, ref, &commitWg, commitChan)
|
auditRef(r, ref, &commitWg, commitChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user