Skip to content

Enhance sync script with cherry-pick functionality and improve merge conflict handling Co-authored-by: Copilot <copilot@github.com>#267

Merged
LoserCheems merged 5 commits intomainfrom
optim-combine-func
Apr 21, 2026
Merged

Enhance sync script with cherry-pick functionality and improve merge conflict handling Co-authored-by: Copilot <copilot@github.com>#267
LoserCheems merged 5 commits intomainfrom
optim-combine-func

Conversation

@LoserCheems
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings April 21, 2026 09:21
@LoserCheems LoserCheems merged commit 431e685 into main Apr 21, 2026
3 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the sync_cute_subtree.sh vendoring/sync workflow to better handle upstream merges and to cherry-pick sync commits back into a dirty working tree more robustly.

Changes:

  • Add configurable merge commit message and merge conflict strategy option for the subtree merge step.
  • Introduce cherry_pick_commit_back() to handle merge-commit cherry-picks and gracefully skip empty cherry-picks.
  • Replace inline cherry-pick logic in the temporary worktree flow with the new helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

echo "Pulling upstream updates into $PREFIX ..."
invoke_git -C "$work_repo_root" fetch "$UPSTREAM_REPO_FOR_SPLIT" "$TEMP_BRANCH"
invoke_git_no_merge_edit -C "$work_repo_root" merge -X theirs "-Xsubtree=$PREFIX" FETCH_HEAD
invoke_git_no_merge_edit -C "$work_repo_root" merge -m "$MERGE_COMMIT_MESSAGE" "-X$MERGE_CONFLICT_OPTION" "-Xsubtree=$PREFIX" FETCH_HEAD
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERGE_CONFLICT_OPTION defaults to ours, which changes conflict resolution from the previous -X theirs behavior. For a vendored subtree sync, preferring local changes on conflicts can silently drop upstream updates in conflicted hunks. Consider defaulting back to theirs (or making the strategy configurable via a CLI flag/env var) so upstream wins by default during the merge.

Suggested change
invoke_git_no_merge_edit -C "$work_repo_root" merge -m "$MERGE_COMMIT_MESSAGE" "-X$MERGE_CONFLICT_OPTION" "-Xsubtree=$PREFIX" FETCH_HEAD
invoke_git_no_merge_edit -C "$work_repo_root" merge -m "$MERGE_COMMIT_MESSAGE" "-X${MERGE_CONFLICT_OPTION:-theirs}" "-Xsubtree=$PREFIX" FETCH_HEAD

Copilot uses AI. Check for mistakes.
return 0
fi

echo "Cherry-pick $commit failed with conflicts. Resolve manually and continue." >&2
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure message says "failed with conflicts", but git cherry-pick can also fail for non-conflict reasons (e.g., existing CHERRY_PICK_HEAD / other in-progress operations). Consider making this message more specific/guiding by including the next steps (e.g., git cherry-pick --continue / --abort) and/or suggesting git status to confirm the state.

Suggested change
echo "Cherry-pick $commit failed with conflicts. Resolve manually and continue." >&2
echo "Cherry-pick $commit failed. Run 'git -C \"$REPO_ROOT\" status' to inspect the repository state. If a cherry-pick is in progress, resolve it and run 'git -C \"$REPO_ROOT\" cherry-pick --continue', or run 'git -C \"$REPO_ROOT\" cherry-pick --abort' to cancel it." >&2

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants