๐ fix: pre-push judges a merge of the default branch by the branch's own slice
Merged
AT
1mo ago+249+249+012345678901234567890123456789-28-28-01234567890123456789
Slice: #40
Fixes State #131 of P-15: under squash merges, the default branch's commits name other slices, and pre-push could count them as a push's own.
src/work.ts,prePush: every commit on the remote's default branch is left out of a push's range, beside what the remote already has: the default branch's tip as GitHub names it (git/ref/heads/<default>), when the clone has that commit, andrefs/remotes/origin/<default>, when there is one. Either can be missing or behind, as in a single-branch clone that fetched the default branch intoFETCH_HEADalone, where--remotesdid not cover the merged commits.- Where those tips are behind (main moved on after a
FETCH_HEADmerge) and the push would be refused, GitHub's compare API is asked about each commit the push's merges brought other than through their first parent; those on the default branch (behindoridentical) are left out too. Nothing is asked when the push already names one slice. - When a push's new commits name no slice (a merge tip with no trailer, or any commit with none), the branch's own commits, those the default branch does not reach, decide: exactly one slice passes on to the slice's rules; none or several are refused as before. Where the clone cannot tell where the default branch is, the old rule stands (a push of only merges is judged by what the merges did not bring).
src/features.ts: the repository read is shared, soisPersonaland the default branch cost one request between them.- README: the pre-push paragraph says so.
- Tests, on real git histories whose default branch has squash-merged two other slices: a new branch's first push; a merge of the default branch fetched into
FETCH_HEADwith no remote-tracking ref (passes with GitHub's tip; passes when main moved on and GitHub's compare says the merged commit is on main; refused as before when GitHub cannot say or saysdiverged); no compare asked for a push naming its slice; a trailer-less merge tip and a trailer-less commit on a branch already naming its slice, with GitHub's tip newer than the clone; a branch whose own commits name two slices (still refused); one whose own commits name none (still refused). Every other check is unchanged.
pnpm check passes (874 tests, work.ts 100% lines).
๐ค Generated with Claude Code