From 18b0ecbb2a1b22cbbc02961a9166db0e3a865ab1 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Wed, 8 Nov 2023 10:29:01 -0600 Subject: [PATCH] releng: add --first-parent to the scripts that use git log (#16279) It makes the output less cluttered and more correct (for example: ServicingPipeline no longer tries to service two copies of each commit if there's a merge in the history...) --- tools/Get-OSSConhostLog.ps1 | 2 +- tools/ReleaseEngineering/New-TerminalStackedChangelog.ps1 | 2 +- tools/ReleaseEngineering/ServicingPipeline.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/Get-OSSConhostLog.ps1 b/tools/Get-OSSConhostLog.ps1 index 4c206effa8..46cd8aca1f 100644 --- a/tools/Get-OSSConhostLog.ps1 +++ b/tools/Get-OSSConhostLog.ps1 @@ -43,7 +43,7 @@ Function Get-Git2GitIgnoresAsExcludes() { $Excludes = Get-Git2GitIgnoresAsExcludes Write-Verbose "IGNORING: $Excludes" -$Entries = & git log $RevisionRange "--pretty=format:%an%x1C%ae%x1C%s" -- $Excludes | +$Entries = & git log $RevisionRange --first-parent "--pretty=format:%an%x1C%ae%x1C%s" -- $Excludes | ConvertFrom-CSV -Delimiter "`u{001C}" -Header Author,Email,Subject Write-Verbose ("{0} unfiltered log entries" -f $Entries.Count) diff --git a/tools/ReleaseEngineering/New-TerminalStackedChangelog.ps1 b/tools/ReleaseEngineering/New-TerminalStackedChangelog.ps1 index 7f442f2ccf..4d48b18bbf 100644 --- a/tools/ReleaseEngineering/New-TerminalStackedChangelog.ps1 +++ b/tools/ReleaseEngineering/New-TerminalStackedChangelog.ps1 @@ -62,7 +62,7 @@ ForEach ($RevisionRange in $RevisionRanges) { # - %ae: author email # - %x1C: another FS # - %s: subject, the title of the commit - $NewEntries = & git log $RevisionRange "--pretty=format:%an%x1C%ae%x1C%s" | + $NewEntries = & git log $RevisionRange --first-parent "--pretty=format:%an%x1C%ae%x1C%s" | ConvertFrom-CSV -Delimiter "`u{001C}" -Header Author,Email,Subject $Entries += $NewEntries | % { [PSCustomObject]@{ diff --git a/tools/ReleaseEngineering/ServicingPipeline.ps1 b/tools/ReleaseEngineering/ServicingPipeline.ps1 index d7eb2cfebc..2adf3843a0 100644 --- a/tools/ReleaseEngineering/ServicingPipeline.ps1 +++ b/tools/ReleaseEngineering/ServicingPipeline.ps1 @@ -89,7 +89,7 @@ $Cards = Get-GithubProjectCard -ColumnId $ToPickColumn.id & git fetch --all 2>&1 | Out-Null -$Entries = @(& git log $SourceBranch --grep "(#\($($Cards.Number -Join "\|")\))" "--pretty=format:%H%x1C%s" | +$Entries = @(& git log $SourceBranch --first-parent --grep "(#\($($Cards.Number -Join "\|")\))" "--pretty=format:%H%x1C%s" | ConvertFrom-CSV -Delimiter "`u{001C}" -Header CommitID,Subject) [Array]::Reverse($Entries)