From 2fac84dd1e2b6e49f413260d46b2f90a7f005c7c Mon Sep 17 00:00:00 2001 From: Arlo Date: Tue, 1 Jul 2025 15:39:06 -0500 Subject: [PATCH] Ensure orphaned commits are available for diffing by fetching the specified FromSha --- Get-Changed-Components.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Get-Changed-Components.ps1 b/Get-Changed-Components.ps1 index 1e9d714..8d06acb 100644 --- a/Get-Changed-Components.ps1 +++ b/Get-Changed-Components.ps1 @@ -30,6 +30,8 @@ if (-not $ToSha) { $ToSha = $(git rev-parse HEAD) } +# Ensure that orphaned commits are available for diffing (e.g. when force-pushed). +git fetch origin $FromSha git fetch origin main $changedComponentFiles = Invoke-Expression "git diff --name-only $($FromSha)...$($ToSha) -- components/" -ErrorAction Stop