integration: Auto-rebuild integration branch on restack#1176
Open
ed-irl wants to merge 2 commits into
Open
Conversation
Collaborator
Author
This was referenced May 19, 2026
Open
b465e86 to
662e8bb
Compare
3d69746 to
b244544
Compare
662e8bb to
8fa2e91
Compare
b244544 to
2ef2338
Compare
ab72632 to
bbb1d83
Compare
2ef2338 to
f05a942
Compare
bbb1d83 to
bced906
Compare
This was referenced Jun 12, 2026
f05a942 to
236b9b1
Compare
bced906 to
8dfba8a
Compare
236b9b1 to
22fa68b
Compare
8dfba8a to
e08f418
Compare
3825398 to
fb9a0e5
Compare
4b4fe32 to
40200ac
Compare
Adds a git-native `regenerate` merge driver that re-runs the
appropriate generator for derived files when they conflict, rather
than picking a side. Picking a side is unsafe here: many of these
files are only PARTIALLY stochastic. Two branches may have added or
changed real structure (a new flag, test case, mock method) on top of
random ID drift, and a blind take-one silently drops the other side's
structural change. Regenerating against the merged source produces
the correct merged output.
Path mappings, in .githooks/merge-regenerate:
- internal/forge/shamhub/testdata/** -> go test -run TestIntegration
./internal/forge/shamhub/ -update
- testdata/help/*.txt -> go test -run TestHelp . -update
- doc/includes/cli-*.md -> mise run generate
- mocks*.go / mock_*.go / mocks.go -> mise run generate
Generators that emit many files in one run are deduped per merge via
a tmp marker keyed by the parent PID, so the shamhub test runs at
most once even if all 47 fixture files in its output set conflict.
`mise run setup` registers the driver locally; .gitattributes
declares the path mappings. No post-merge hook is needed: the
driver handles conflicts directly during the merge.
d3de5c3 to
a89d717
Compare
42fe375 to
2fe1405
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restack commands now invoke the integration handler's MaybeRebuild
after restacking, so the integration branch is rebuilt automatically
when its tracked tips drift. Wired into branch, upstack, stack, and
repo restack.
MaybeRebuild is a no-op when no integration branch is configured or
when no tracked tip has drifted, so the second consecutive restack
does not rebuild again.
Adds testdata/script/integration_auto_rebuild.txt covering the
drift-then-restack path, and sets user.name/email in the merge
worktree tests so commits succeed in clean environments.
Part of #1244