mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 21:24:21 +01:00
scan: fix dropped errors (#424)
This commit is contained in:
1 parent
ef4655fcf1
commit
b5ca2ba614
3 files changed
+14
No files matched your search
@@ -201,6 +201,10 @@ func getLogOptions(repo *Repo) (*git.LogOptions, error) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
if logOpts.From.IsZero() {
|
if logOpts.From.IsZero() {
|
||||||
return nil, fmt.Errorf("could not find branch %s", repo.Manager.Opts.Branch)
|
return nil, fmt.Errorf("could not find branch %s", repo.Manager.Opts.Branch)
|
||||||
}
|
}
|
||||||
@@ -259,6 +263,10 @@ func (repo *Repo) loadRepoConfig() (config.Config, error) {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
var tomlLoader config.TomlLoader
|
var tomlLoader config.TomlLoader
|
||||||
_, err = toml.DecodeReader(f, &tomlLoader)
|
_, err = toml.DecodeReader(f, &tomlLoader)
|
||||||
|
if err != nil {
|
||||||
|
return config.Config{}, err
|
||||||
|
}
|
||||||
|
|
||||||
return tomlLoader.Parse()
|
return tomlLoader.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,9 @@ func (repo *Repo) scanEmpty() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
status, err := wt.Status()
|
status, err := wt.Status()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
for fn := range status {
|
for fn := range status {
|
||||||
workTreeBuf := bytes.NewBuffer(nil)
|
workTreeBuf := bytes.NewBuffer(nil)
|
||||||
workTreeFile, err := wt.Filesystem.Open(fn)
|
workTreeFile, err := wt.Filesystem.Open(fn)
|
||||||
|
|||||||
@@ -422,6 +422,9 @@ func TestScan(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = m.Report()
|
err = m.Report()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
if test.wantEmpty {
|
if test.wantEmpty {
|
||||||
if len(m.GetLeaks()) != 0 {
|
if len(m.GetLeaks()) != 0 {
|
||||||
|
|||||||
Reference in new issue
Block a user