Skip to content

Commit

Permalink
Merge pull request #162 from theohbrothers/enhancement/generate-impro…
Browse files Browse the repository at this point in the history
…ve-robustness-of-function-get-repositorycommithistory

Enhancement (generate): Improve robustness of function `Get-RepositoryCommitHistory`
  • Loading branch information
joeltimothyoh authored Jul 22, 2024
2 parents f864713 + 5f1e58f commit 9574b1a
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Get-RepositoryCommitHistory {
[switch]$Merges
,
[Parameter(Mandatory=$false)]
[string]$NoMerges
[switch]$NoMerges
)

try {
Expand All @@ -45,14 +45,11 @@ function Get-RepositoryCommitHistory {
$commitSHARange = $FirstRef
}
$gitArgs = @(
'--no-pager'
'log'
"--pretty=format:$($PrettyFormat)"
$commitSHARange
if ($PrettyFormat) { "--pretty=format:$PrettyFormat" }
if ($Merges) { '--merges' }
elseif ($NoMerges) { '--no-merges' }
if ($NoMerges) { '--no-merges' }
)
$_commitHistory = git $gitArgs
$_commitHistory = git --no-pager log $commitSHARange @gitArgs
"Changelog:" | Write-Verbose
$_commitHistory | Write-Verbose
$_commitHistory
Expand Down

0 comments on commit 9574b1a

Please sign in to comment.