fix: add --reverse to get_pr_for_file ancestry lookup (#129)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
Agent 2026-04-01 20:21:31 +00:00
parent e40ea2acf2
commit 978dd88347

View file

@ -120,8 +120,9 @@ get_pr_for_file() {
# Step 2: find the merge commit that contains it via ancestry path
local merge_line
# Use --reverse to get the oldest (direct PR merge) first, not the newest
merge_line=$(git -C "$OPS_REPO_ROOT" log --merges --ancestry-path \
"${add_commit}..HEAD" --oneline 2>/dev/null | head -1)
--reverse "${add_commit}..HEAD" --oneline 2>/dev/null | head -1)
if [ -z "$merge_line" ]; then
return 1