Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Full git log when targeting base merge commit (#1044)
Bill Rich00ebb2ed6481
diff --git a/pkg/gitparse/gitparse.go b/pkg/gitparse/gitparse.goindex caa8066a3..aa22a9212 100644--- a/pkg/gitparse/gitparse.go+++ b/pkg/gitparse/gitparse.go@@ -75,8 +75,11 @@ func (c1 *Commit) Equal(c2 *Commit) bool {}// RepoPath parses the output of the `git log` command for the `source` path.-func RepoPath(ctx context.Context, source string, head string) (chan Commit, error) {- args := []string{"-C", source, "log", "-p", "-U5", "--full-history", "--diff-filter=AM", "--date=format:%a %b %d %H:%M:%S %Y %z"}+func RepoPath(ctx context.Context, source string, head string, abbreviatedLog bool) (chan Commit, error) {+ args := []string{"-C", source, "log", "-p", "-U5", "--full-history", "--date=format:%a %b %d %H:%M:%S %Y %z"}+ if abbreviatedLog {+ args = append(args, "--diff-filter=AM")+ }if head != "" {args = append(args, head)} else {diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.goindex 1bdc3e12a..f2f580351 100644--- a/pkg/sources/git/git.go+++ b/pkg/sources/git/git.go@@ -330,7 +330,7 @@ func (s *Git) ScanCommits(ctx context.Context, repo *git.Repository, path stringreturn err}- commitChan, err := gitparse.RepoPath(ctx, path, scanOptions.HeadHash)+ commitChan, err := gitparse.RepoPath(ctx, path, scanOptions.HeadHash, scanOptions.BaseHash == "")if err != nil {return err}