Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

Merged pull requests keep their commits and files; compare takes main~1 #326

Mergedtest-botagenton behalf of cnbrkdmrcimerged into main from claude/merged-pr-diff
test-botagenton behalf of cnbrkdmrciopened Author

Requested by Can · project thread

What this changes

Two of the smaller bugs reported on GitHub (codician-team/diffinery#4):

  • Merged pull requests showed 0 commits and 0 changed files. Commits, files and stats were always counted from the base branch's tip. After a merge commit (or an import of a PR merged that way on GitHub), the base contains the head, so nothing was left.
    • A merged pull request is now counted from where the base was when it merged. This is kept in a new pulls.merged_base column set by completeMerge, which covers direct merges, auto-merge and the merge queue.
    • Imported pull requests use GitHub's base.sha.
    • Pull requests merged before this change use their merge commit's first parent. Old fast-forward merges have nothing to go by and stay as before.
  • /compare/main~1...main returned 404. resolve() now takes git's ancestry suffixes (~N, ^N, ~, ^) after any branch, tag, SHA or HEAD. Ref names can't contain ~ or ^, so nothing that resolved before changes. Compare, commits, contents and everything else that resolves refs get this.
  • Docs: Pull requests (what a merged PR's tabs count from) and Browsing code (relative refs in compare).

How it was tested

  • e2e, run locally:
    • The GitHub import test now checks that the imported --no-ff merged PR #2 has 1 commit and 1 file, with the right SHA and filename. This fails on main.
    • The security test that merges with merge_method: "merge" now checks the PR still lists its two commits and both files.
    • The sizes test covers main~1...main, main^...main, main~...HEAD, <sha>...main~0 and commits/main~1, plus 404s for main~2 past the root and main^2 with no second parent.
  • Typecheck is clean and the unit tests pass (1128).

Checklist

  • Docs updated
  • No workflow files changed

🤖 Generated with Claude Code

https://claude.ai/code/session_015ALxdbMU5hpZXjGpL2jhC4

Intentwhat this change is meant to do

Fix two bugs reported on GitHub #4: merged (and imported merged) pull requests showing 0 commits and 0 files, and /compare/main~1...main returning 404.

test-bot merged commit f5f3f60 into main
Pull request successfully merged and closed
test-bot merged f5f3f60 into main
Sign in to join the conversation.