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

nchammas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new c3d9631787e8 [SPARK-58944][INFRA] Complete cherry pick as part of 
merge script
c3d9631787e8 is described below

commit c3d9631787e82d93cef685d6573e2afddd9ef1f9
Author: Nicholas Chammas <[email protected]>
AuthorDate: Thu Aug 27 08:55:34 2026 -0400

    [SPARK-58944][INFRA] Complete cherry pick as part of merge script
    
    ### What changes were proposed in this pull request?
    
    When a conflict occurs on cherry picking a commit to a branch, ask the user 
to fix the conflict but have the script continue the cherry pick itself.
    
    ### Why are the changes needed?
    
    If the user calls `git cherry-pick --continue` themselves, commit message 
lines starting with `#` will be interpreted as comments and stripped. This is 
[what happened to me here][1]. Compare the commit message on 
https://github.com/apache/spark/commit/9a75a1d04be4b82c0626f5ac00cb65b59cfdf37e 
(master) to 
https://github.com/apache/spark/commit/8cc56ea6006b4ea182df5ed4713ba345ea8e5e74 
(branch-4.x) and note how every line beginning with `#` was stripped from the 
latter.
    
    [1]: https://github.com/apache/spark/pull/58136#issuecomment-5371712660
    
    I'm not the only one who has hit this. It seems this has been happening for 
a while.
    
    #### Cherry-Pick Commit Message Loss Cases
    
    In all of these cases, the `branch-4x` commit messages are malformed 
relative to the originals from `master`.
    
    | Date | `master` source | `branch-4.x` backport |
    |---|---|---|
    | 2026-07-21 | 
[99025ce](https://github.com/apache/spark/commit/99025ce39d587125f37bb4305a29c26c0b9317ff)
 | 
[98e98b7](https://github.com/apache/spark/commit/98e98b717786508fa76b8ddf0732a6672613e56a)
 |
    | 2026-07-20 | 
[6b719b3](https://github.com/apache/spark/commit/6b719b39daf82a9e5cdd579992b6e3577b0b519b)
 | 
[6c0a252](https://github.com/apache/spark/commit/6c0a252193f8d81bd8790a67a2b0e96eee8efc9a)
 |
    | 2026-07-14 | 
[226340c](https://github.com/apache/spark/commit/226340cb107f3924c6bde9512e1cee7e06f7dd38)
 | 
[67df419](https://github.com/apache/spark/commit/67df419436ccf690ef0947d5c7b037958a093134)
 |
    | 2026-07-11 | 
[710b3c4](https://github.com/apache/spark/commit/710b3c45aab88bd14e51d49f400e2f31e3b65772)
 | 
[da117f6](https://github.com/apache/spark/commit/da117f667ed61667902cbd1d5e2686588fae40ce)
 |
    | 2026-06-18 | 
[880083f](https://github.com/apache/spark/commit/880083fd7d160ac770802dd0911d738e6ba426ca)
 | 
[84fcfba](https://github.com/apache/spark/commit/84fcfbada56f000342e6ce90b57f828e40103bbf)
 |
    | 2026-06-16 | 
[2fb4a1b](https://github.com/apache/spark/commit/2fb4a1bf2b1b504d5211c7f681fe774587db5b09)
 | 
[07d9f34](https://github.com/apache/spark/commit/07d9f341b3c1bfba7a279e4b31cd30625d0eeeb5)
 |
    | 2026-06-03 | 
[13b526d](https://github.com/apache/spark/commit/13b526d534e3b6115be4769d39d861b321bb3a02)
 | 
[7a70689](https://github.com/apache/spark/commit/7a70689cfc8147d2c580179a55cc6b0c8c292afc)
 |
    | 2026-05-25 | 
[0af3d42](https://github.com/apache/spark/commit/0af3d42c2c35cc6e7124eb1382aa240ecdf0f711)
 | 
[bdd5fdf](https://github.com/apache/spark/commit/bdd5fdfde0da074026c58e761071220f624cda20)
 |
    | 2026-05-16 | 
[0a0d31b](https://github.com/apache/spark/commit/0a0d31bea007cd1d7a152e8127dc6b0cfbd20abb)
 | 
[f5273c7](https://github.com/apache/spark/commit/f5273c77b7fd4430a7776a232cf96e738005687a)
 |
    | 2026-05-13 | 
[436291e](https://github.com/apache/spark/commit/436291ec35b30b634bcde9ef35ddeb402dc70c06)
 | 
[f67a855](https://github.com/apache/spark/commit/f67a8551e0b707dcf9adeaed9aba2ad14f0a0915)
 |
    | 2026-05-08 | 
[bb72aef](https://github.com/apache/spark/commit/bb72aef62854ac35aad11cd7b4813784a539d289)
 | 
[e7ae20a](https://github.com/apache/spark/commit/e7ae20aced6fd226c1f7206ba9a9414203d04599)
 |
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    I used this test script to confirm that `commit.cleanup=scissors` preserves 
Markdown headings and other lines that begin with `#` when there is a cherry 
pick conflict.
    
    
[test-cherry-pick-commit-msg.sh](https://github.com/user-attachments/files/31342347/test-cherry-pick-commit-msg.sh)
    
    I also tried the merge script from this branch with `--dry-run` and it 
worked, including a conflicted cherry pick to `branch-4.x`.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    I wrote this with assistance from GitHub Copilot.
    
    Closes #58214 from nchammas/merge-pr-cherry-pick-whitespace.
    
    Authored-by: Nicholas Chammas <[email protected]>
    Signed-off-by: Nicholas Chammas <[email protected]>
---
 dev/merge_spark_pr.py | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py
index 08441aa8cc08..bfa633c29cb8 100755
--- a/dev/merge_spark_pr.py
+++ b/dev/merge_spark_pr.py
@@ -781,12 +781,33 @@ def _do_cherry_pick(pr_num, merge_hash, pick_ref):
     git.run("git checkout %s" % pick_branch_name)
 
     try:
-        git.run("git cherry-pick -sx %s" % merge_hash)
+        git.run(
+            [
+                "git",
+                "-c",
+                "commit.cleanup=scissors",
+                "cherry-pick",
+                "-sx",
+                merge_hash,
+            ]
+        )
     except Exception as e:
         msg = "Error cherry-picking: %s\nWould you like to manually fix-up 
this merge?" % e
         continue_maybe(msg, True)
-        msg = "Okay, please fix any conflicts and finish the cherry-pick. 
Finished?"
+        msg = "Okay, please fix any conflicts and 'git add' conflicting 
files... Finished?"
         continue_maybe(msg, True)
+        # Important to use `scissors` and `--edit` otherwise git will strip 
lines starting with `#`
+        # when calling `--continue`. See: 
https://github.com/apache/spark/pull/58214
+        git.run(
+            [
+                "git",
+                "-c",
+                "commit.cleanup=scissors",
+                "cherry-pick",
+                "--continue",
+                "--edit",
+            ]
+        )
 
     continue_maybe(
         "Pick complete (local ref %s). Push to %s?" % (pick_branch_name, 
PUSH_REMOTE_NAME)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to