Skip to content

Commit

Permalink
Full git log when targeting base merge commit (#1044)
Browse files Browse the repository at this point in the history
* Full git log when targeting merge commits

* Full log is needed whenever base is specified.
  • Loading branch information
bill-rich committed Jan 26, 2023
1 parent 4ef546a commit 00ebb2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pkg/gitparse/gitparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sources/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 00ebb2e

Please sign in to comment.