fixes #36 Use commit SHA comparison for push detection#37
Conversation
git diff --quiet compares file trees, not commit history. Merge commits that don't change file content (e.g., already cherry-picked changes) were silently skipped, leaving local commits unpushed. Co-authored-by: Cursor <cursoragent@cursor.com>
WalkthroughThe push detection logic in manual-merge.sh is changed from comparing file trees using Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
manual-merge.sh (1)
126-132:⚠️ Potential issue | 🟡 Minor
branch-herepush path still lacks the SHA guard introduced for the merge-forward path.The PR objectives explicitly call out applying the same commit-SHA comparison here. Line 131 pushes unconditionally; an already-in-sync
branch-herealways incurs an unnecessary push round-trip.🛠️ Proposed fix to align `branch-here` push with the new SHA guard
# Fast-forward to release branch if ! git merge --ff-only "origin/$release_branch"; then log_error " Could not fast-forward $branch_here. This may require manual intervention." exit 1 fi - git push origin "$branch_here" - log_info " Updated successfully." + if [ "$(git rev-parse HEAD)" != "$(git rev-parse "origin/$branch_here")" ]; then + git push origin "$branch_here" + log_info " Updated successfully." + else + log_info " Already up to date with origin." + fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@manual-merge.sh` around lines 126 - 132, Before unconditionally running git push origin "$branch_here", compute the remote and local commit SHAs (e.g., remote_sha=$(git ls-remote origin "refs/heads/$branch_here" | cut -f1) and local_sha=$(git rev-parse "$branch_here")) and compare them; only call git push origin "$branch_here" when local_sha != remote_sha, otherwise call log_info that "$branch_here" is already up-to-date and skip the push; keep existing error handling (log_error/exit) for push failures and reuse the same log messages used around the merge-forward path for consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@manual-merge.sh`:
- Around line 126-132: Before unconditionally running git push origin
"$branch_here", compute the remote and local commit SHAs (e.g., remote_sha=$(git
ls-remote origin "refs/heads/$branch_here" | cut -f1) and local_sha=$(git
rev-parse "$branch_here")) and compare them; only call git push origin
"$branch_here" when local_sha != remote_sha, otherwise call log_info that
"$branch_here" is already up-to-date and skip the push; keep existing error
handling (log_error/exit) for push failures and reuse the same log messages used
around the merge-forward path for consistency.
Fixes #36
git diff --quietcompares file trees, not commit history. Merge commits that don't change file content (e.g., already cherry-picked changes) were silently skipped, leaving local commits unpushed on release branches.Replaces the tree comparison with a
git rev-parseSHA comparison so any unpushed commits trigger a push regardless of content changes.Made with Cursor