Skip to content

Commit d32f26f

Browse files
kerneltoastclaude
authored andcommitted
ciq-cherry-pick.py: Drop git's conflict comment block from MERGE_MSG
When a cherry-pick hits a conflict, git appends a comment block to MERGE_MSG ("# Conflicts:" followed by the conflicted paths). manage_commit_message() reads MERGE_MSG, inserts the CIQ header block, and writes the whole thing back, conflict comments included. The script then exits telling the user to resolve the conflict and commit, and committing with -F keeps those lines, since -F's default cleanup mode only strips whitespace, not comments. The conflict block winds up in the final commit message verbatim. Fix it by dropping the tail of the message starting at the "# Conflicts:" line before standardizing. Only the trailing git-generated block goes; legitimate body lines starting with "#" earlier in the message survive. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent b126c7d commit d32f26f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎ciq-cherry-pick.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ def manage_commit_message(full_sha, ciq_tags, jira_ticket, commit_successful):
179179
except IOError as e:
180180
raise RuntimeError(f"Failed to read commit message from {MERGE_MSG}: {e}") from e
181181

182+
# git appends a "# Conflicts:" comment block to MERGE_MSG on a conflicted
183+
# cherry-pick, and committing with -F doesn't strip comment lines. Drop the
184+
# block to keep it out of the final commit message.
185+
for i, line in enumerate(original_msg):
186+
if line.rstrip("\n") == "# Conflicts:":
187+
original_msg = original_msg[:i]
188+
break
189+
182190
optional_msg = "" if commit_successful else "upstream-diff |"
183191
new_msg = CIQ_cherry_pick_commit_standardization(
184192
original_msg, full_sha, jira=jira_ticket, tags=new_tags, optional_msg=optional_msg

0 commit comments

Comments
 (0)