mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
fix(cmd): read log-opts before GitLogCmd (#1730)
This commit is contained in:
1 parent
d88bc094f7
commit
1f323d8b69
1 file changed
+1
-2
+1
-2
@@ -96,10 +96,10 @@ func runDetect(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var (
|
var (
|
||||||
|
logOpts = mustGetStringFlag(cmd, "log-opts")
|
||||||
gitCmd *sources.GitCmd
|
gitCmd *sources.GitCmd
|
||||||
scmPlatform scm.Platform
|
scmPlatform scm.Platform
|
||||||
remote *detect.RemoteInfo
|
remote *detect.RemoteInfo
|
||||||
logOpts string
|
|
||||||
)
|
)
|
||||||
if gitCmd, err = sources.NewGitLogCmd(source, logOpts); err != nil {
|
if gitCmd, err = sources.NewGitLogCmd(source, logOpts); err != nil {
|
||||||
logging.Fatal().Err(err).Msg("could not create Git cmd")
|
logging.Fatal().Err(err).Msg("could not create Git cmd")
|
||||||
@@ -110,7 +110,6 @@ func runDetect(cmd *cobra.Command, args []string) {
|
|||||||
if remote, err = detect.NewRemoteInfo(scmPlatform, source); err != nil {
|
if remote, err = detect.NewRemoteInfo(scmPlatform, source); err != nil {
|
||||||
logging.Fatal().Err(err).Msg("failed to scan Git repository")
|
logging.Fatal().Err(err).Msg("failed to scan Git repository")
|
||||||
}
|
}
|
||||||
logOpts = mustGetStringFlag(cmd, "log-opts")
|
|
||||||
|
|
||||||
if findings, err = detector.DetectGit(gitCmd, remote); err != nil {
|
if findings, err = detector.DetectGit(gitCmd, remote); err != nil {
|
||||||
// don't exit on error, just log it
|
// don't exit on error, just log it
|
||||||
|
|||||||
Reference in new issue
Block a user