Skip to content

fix: pull merge matching, PR update hash, and force-push branch tip - #78

Merged
hokwangchoi merged 1 commit into
hokwangchoi:masterfrom
simtel12:pgit/gregorios-leach/fix--pull-merge-matching--pr-update-hash--and-forc
May 6, 2026
Merged

fix: pull merge matching, PR update hash, and force-push branch tip#78
hokwangchoi merged 1 commit into
hokwangchoi:masterfrom
simtel12:pgit/gregorios-leach/fix--pull-merge-matching--pr-update-hash--and-forc

Conversation

@simtel12

@simtel12 simtel12 commented May 5, 2026

Copy link
Copy Markdown

Summary

  • Force-push the intended commit when updating a PR branch you have checked out. force_update_and_push used to skip git branch -f when the working branch matched the PR branch, so git push -f could still publish whatever was at HEAD instead of the requested hash. It now compares the branch tip to the target hash and resets the ref whenever they differ (still trimming the hash input).

  • Resolve the PR update hash from the live stack. handle_update_pr no longer trusts a possibly stale hash from when the suspend was queued. It re-resolves by matching the patch subject to the current stack (cursor first, then scan) and surfaces a clear error with a refresh hint if the commit moved.

  • More reliable “pull remote” merges during interactive rebase. Diverged PR stops are keyed by both subject and full commit hash, so rebase/edit/amend flows still match after subject lines diverge from git log -1 --format=%s. Temp pgit-temp-patch-* branches are deleted once per unique remote ref. If fewer merges ran than expected, the UI warns about partial merges and overwriting remote-only work.

  • Propagate errors from reload_stack() after PR update and after pull so failures are not silently ignored.

Test plan

  • Update a PR while that PR branch is checked out; confirm remote tip matches the stack commit you chose (not an older HEAD).
  • Queue/update PR after a rebase that changes hashes; confirm update uses the new hash or errors with the refresh hint when the subject no longer matches.
  • Pull remote with diverged PRs where subject formatting differs from git log -1; confirm merge stops still find the right remote ref.
  • Partial-merge scenario: confirm warning when not all expected diverged PRs get a merge during the rebase loop.

Compare branch tip to target hash with rev-parse and always branch -f when
they differ so pushes are correct even when that branch is checked out.

Resolve the stack commit hash from the current stack before updating a PR,
propagate reload errors, and key pull merge sources by subject and commit
hash so rebase edit stops still match after subject normalization. Deduplicate
temp-branch cleanup, warn when fewer merges than expected, and refresh the
stack after pull.

Made-with: Cursor
@hokwangchoi
hokwangchoi merged commit 564f4f7 into hokwangchoi:master May 6, 2026
1 check passed
@simtel12
simtel12 deleted the pgit/gregorios-leach/fix--pull-merge-matching--pr-update-hash--and-forc branch May 6, 2026 22:11
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.

3 participants