This is an automated email from the ASF dual-hosted git repository.

Yicong-Huang pushed a commit to branch ci/backport-rename-detection
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 1c0fc5701111bec48865d119704d43c97c645844
Author: Yicong Huang <[email protected]>
AuthorDate: Tue Jul 28 01:17:06 2026 -0400

    ci: harden backport cherry-pick against package/directory renames
    
    Both backport scripts invoke `git cherry-pick` bare, leaving three merge
    knobs at defaults that misbehave when a package/directory rename lands
    between main and a release branch:
    
    - merge.renameLimit / diff.renameLimit: Git silently skips inexact rename
      detection once unpaired paths exceed the limit, so renamed files degrade
      to deleted+added and picked hunks hit paths that no longer exist.
    - merge.directoryRenames (default `conflict`): files a backport *adds*
      under an old package path are not auto-placed into the renamed directory.
    - rename-threshold: a rename that also rewrites package/import lines can
      drop a small file below the 50% default and be missed.
    
    Wrap both cherry-picks (preflight and fallback-branch) identically with
    raised rename limits, directory-rename detection, and a 40% threshold so a
    green preflight and the branch it later builds cannot disagree. Pure
    config passthrough to the merge machinery; no logic change.
    
    Closes #6963
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
---
 .github/scripts/create-backport-branch.sh    |  8 +++++++-
 .github/scripts/prepare-backport-checkout.sh | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/.github/scripts/create-backport-branch.sh 
b/.github/scripts/create-backport-branch.sh
index 68f22d9ece..32c8fe5e69 100755
--- a/.github/scripts/create-backport-branch.sh
+++ b/.github/scripts/create-backport-branch.sh
@@ -91,7 +91,13 @@ git checkout -B "${branch}" "origin/${TARGET_BRANCH}"
 # everything turns the unmerged entries into a normal (dirty) commit.
 had_conflict=false
 conflict_files=""
-if ! git cherry-pick --no-commit "${MERGE_SHA}"; then
+# Rename-detection knobs kept identical to prepare-backport-checkout.sh so a
+# green preflight and this branch don't disagree over a package/directory
+# rename. See that script for the rationale behind each setting.
+if ! git -c merge.renameLimit=999999 \
+         -c diff.renameLimit=999999 \
+         -c merge.directoryRenames=true \
+         cherry-pick -Xrename-threshold=40% --no-commit "${MERGE_SHA}"; then
   had_conflict=true
   conflict_files="$(git diff --name-only --diff-filter=U | tr '\n' ' ')"
   log "cherry-pick conflicted in: ${conflict_files}"
diff --git a/.github/scripts/prepare-backport-checkout.sh 
b/.github/scripts/prepare-backport-checkout.sh
index 5286275516..8696eafe2a 100644
--- a/.github/scripts/prepare-backport-checkout.sh
+++ b/.github/scripts/prepare-backport-checkout.sh
@@ -47,4 +47,15 @@ end_tree="$(git rev-parse "${end_sha}^{tree}")"
 squash_sha="$(git commit-tree -p "${start_sha}" -m "ci: squashed backport of 
${commit_range}" "${end_tree}")"
 
 git checkout -B "${workspace_branch}" "origin/${target_branch}"
-git cherry-pick -x "${squash_sha}"
+# Rename-detection knobs (kept identical in create-backport-branch.sh so the
+# preflight and the branch it later builds agree): a package/directory rename
+# between main and the release branch would otherwise produce spurious
+# conflicts. Raise the rename limits so Git does not silently skip inexact
+# rename detection when many paths moved; enable directory-rename detection so
+# files this backport *adds* under an old package path follow the rename; and
+# lower the similarity threshold since a rename that also rewrites package/
+# import lines can drop a small file below the 50% default.
+git -c merge.renameLimit=999999 \
+    -c diff.renameLimit=999999 \
+    -c merge.directoryRenames=true \
+    cherry-pick -Xrename-threshold=40% -x "${squash_sha}"

Reply via email to