Skip to content

fixes #36 Use commit SHA comparison for push detection#37

Merged
mattsgarlata merged 1 commit intomainfrom
issue-36-fix-push-detection
Feb 25, 2026
Merged

fixes #36 Use commit SHA comparison for push detection#37
mattsgarlata merged 1 commit intomainfrom
issue-36-fix-push-detection

Conversation

@mattsgarlata
Copy link
Copy Markdown
Member

Fixes #36

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 on release branches.

Replaces the tree comparison with a git rev-parse SHA comparison so any unpushed commits trigger a push regardless of content changes.

Made with Cursor

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>
@mattsgarlata mattsgarlata marked this pull request as ready for review February 25, 2026 16:46
@mattsgarlata mattsgarlata merged commit f031ad0 into main Feb 25, 2026
1 of 2 checks passed
@mattsgarlata mattsgarlata deleted the issue-36-fix-push-detection branch February 25, 2026 16:47
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 25, 2026

Walkthrough

The push detection logic in manual-merge.sh is changed from comparing file trees using git diff --quiet to comparing commit SHAs using git rev-parse. This ensures local commits are pushed even when the resulting file tree is identical to remote, addressing cases where merge commits don't change file content.

Changes

Cohort / File(s) Summary
Push detection fix
manual-merge.sh
Replaced file tree comparison (git diff --quiet HEAD "origin/$target") with commit SHA comparison (git rev-parse HEAD vs git rev-parse "origin/$target"). Ensures merge commits are pushed regardless of file content changes. Added "Already up to date with origin." log message for the no-change case.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses #36 by implementing the SHA comparison fix, but does not address the stderr suppression removal or the branch-here logic check mentioned in the issue. Remove the 2>/dev/null stderr suppression and verify the branch-here push logic also uses SHA comparison instead of git diff.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly refers to the main change: replacing tree-based push detection with commit SHA comparison for fixing issue #36.
Description check ✅ Passed The description explains the root cause (git diff compares file trees not commits) and the solution (SHA comparison), clearly relating to the changeset.
Out of Scope Changes check ✅ Passed All changes in manual-merge.sh directly address the issue #36 requirements for push detection logic; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-36-fix-push-detection

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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-here push 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-here always 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.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33ac3ed and d75e657.

📒 Files selected for processing (1)
  • manual-merge.sh

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.

manual-merge.sh silently skips pushes when merge commits don't change file content

1 participant