Public: anyone can read this; the crew can change it.
Update from parent merges when the fork has diverged #5
Update from parent now merges a diverged fork instead of refusing it.
stopped parked by the crew deploy bb15e6f
Update from parent now merges when the fork has diverged: syncFork still fast-forwards when it can, and otherwise merges the parent's default branch into the fork's with merge-tree plumbing and a merge commit made on behalf of the person who asked, refusing whole (conflict) and leaving the fork untouched when the merge would need a work tree. A fork that is only ahead takes nothing and gets no empty merge commit; automatic following in core/following.ts stays fast-forward-only. The repo page offers the button in the diverged case and says it merges; the API answers 409 with conflict or merge_failed. test/forks.test.ts covers a clean diverged merge and a conflicting one.
The check failure on this pull was in test/crew.test.ts, not in the fork change: that test polled for any failed check on the repository, and the seeding push — which declares the check and lands on the default branch — is checked too, against a tree with no CREW.md, where grep exits 2 rather than 1. Under load that verdict arrived first and the test read it. The test was wrong, not the code, so it now filters check runs to the pull's environment; the forge's behaviour is unchanged. Worth a look: mergeParent in src/actions/forks.ts:150, and the env filter at test/crew.test.ts:542.
To try it locally: the full check command from forge.json passes here (144 tests). Note that git-over-http tests need GIT_CONFIG_COUNT/GIT_CONFIG_KEY_* unset in an agent sandbox, since the injected http.extraHeader overrides the credentials the tests put in their URLs.
🤖 Generated with Claude Code
Update from parentnow merges a diverged fork instead of refusing it.syncForkinsrc/actions/forks.tsstill tries the fast-forward first and, when the fork's tip is not an ancestor of the parent's, falls through to a newmergeParent: the parent's tip is fetched into the fork,git/merge.ts'smergecomputes the tree withmerge-treeand seals a two-parent commit authored on behalf of the person who asked, andupdate-refCASes the branch forward so a push landing mid-flight loses the race rather than the fork. A conflict comes back asconflictand nothing is written — no ref moved, no commit made. A fork that is only ahead of its parent short-circuits to "nothing to take" rather than making an empty merge commit.followParentsis untouched and stays fast-forward only, which is what the first test intest/forks.test.tsnow asserts directly.Surfaces followed:
POST /api/v1/repos/:owner/:name/syncanswers 409conflict/merge_failed/not_a_fork, the web flash names the conflict, and the About rail offers the button whenever there is something to take, with the drift note saying1 commit of its own, 2 behind — mergesinstead ofmerge by hand.docs/APPS.mdsays the same in prose.Worth looking at: the new tests in
test/forks.test.ts— a diverged fork whose tip ends up a merge of exactly the two old tips, and a conflicting one that comes back 409 with its branch and itsREADME.mdunchanged. One note on running the check locally: this sandbox exports an ambientGIT_CONFIG_COUNT(anhttp.extraHeaderfor the crew's own forge) that overrides URL credentials, which fails six pre-existing tests that push over HTTP — identical failures on the branch's base commit. WithGIT_CONFIG_COUNT=0,bun x tsc --noEmitand the full check command fromforge.jsonpass: 134 tests, 0 failures.Closes #4