Full git log when targeting base merge commit (#1044)
Lint / lint (push) Waiting to run
Release / Release (push) Waiting to run
Scan for secrets / test (push) Waiting to run
Snifftest / Run Snifftest (push) Waiting to run
Test / test (push) Waiting to run
Test / test-detectors (push) Waiting to run

* Full git log when targeting merge commits

* Full log is needed whenever base is specified.
This commit is contained in:
Bill Rich
2023-01-26 09:17:54 -08:00
committed by GitHub
parent 4ef546a06b
commit 00ebb2ed64
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -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 {
+1 -1
View File
@@ -330,7 +330,7 @@ func (s *Git) ScanCommits(ctx context.Context, repo *git.Repository, path string
return err
}
commitChan, err := gitparse.RepoPath(ctx, path, scanOptions.HeadHash)
commitChan, err := gitparse.RepoPath(ctx, path, scanOptions.HeadHash, scanOptions.BaseHash == "")
if err != nil {
return err
}