1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Use merge-base for git diff in get-changed-files.sh (#57487)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
This commit is contained in:
Alex Nguyen
2025-09-11 12:11:20 -07:00
committed by GitHub
parent bada255f31
commit 2056cc2f47

View File

@@ -18,8 +18,9 @@ git fetch --depth=1 origin main
git fetch --depth=1 origin ${INPUT_HEAD:-HEAD}
# Get diff with status information
# Find the merge-base (common ancestor) instead of using origin/main directly
echo "__ running git diff with status __"
DIFF_OUTPUT=$(git diff --name-status origin/main origin/${INPUT_HEAD:-HEAD})
DIFF_OUTPUT=$(git diff --name-status origin/main...origin/${INPUT_HEAD:-HEAD})
# Function to extract files by pattern from diff output
extract_files() {