Skip to content

integration: Auto-rebuild integration branch on restack#1176

Open
ed-irl wants to merge 2 commits into
ed-irl/integration-hooksfrom
ed-irl/integration-merge-drivers
Open

integration: Auto-rebuild integration branch on restack#1176
ed-irl wants to merge 2 commits into
ed-irl/integration-hooksfrom
ed-irl/integration-merge-drivers

Conversation

@ed-irl

@ed-irl ed-irl commented May 19, 2026

Copy link
Copy Markdown
Collaborator

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

@ed-irl

ed-irl commented May 19, 2026

Copy link
Copy Markdown
Collaborator Author

@ed-irl ed-irl force-pushed the ed-irl/integration-merge-drivers branch from b465e86 to 662e8bb Compare June 2, 2026 20:12
@ed-irl ed-irl force-pushed the ed-irl/integration-hooks branch 2 times, most recently from 3d69746 to b244544 Compare June 2, 2026 22:23
@ed-irl ed-irl force-pushed the ed-irl/integration-merge-drivers branch from 662e8bb to 8fa2e91 Compare June 2, 2026 22:26
@ed-irl ed-irl force-pushed the ed-irl/integration-hooks branch from b244544 to 2ef2338 Compare June 8, 2026 11:15
@ed-irl ed-irl force-pushed the ed-irl/integration-merge-drivers branch from ab72632 to bbb1d83 Compare June 8, 2026 11:15
@ed-irl ed-irl force-pushed the ed-irl/integration-hooks branch from 2ef2338 to f05a942 Compare June 12, 2026 20:08
@ed-irl ed-irl force-pushed the ed-irl/integration-merge-drivers branch from bbb1d83 to bced906 Compare June 12, 2026 20:08
@ed-irl ed-irl force-pushed the ed-irl/integration-hooks branch from f05a942 to 236b9b1 Compare June 13, 2026 13:40
@ed-irl ed-irl force-pushed the ed-irl/integration-merge-drivers branch from bced906 to 8dfba8a Compare June 13, 2026 13:40
@ed-irl ed-irl force-pushed the ed-irl/integration-hooks branch from 236b9b1 to 22fa68b Compare June 15, 2026 09:53
@ed-irl ed-irl force-pushed the ed-irl/integration-merge-drivers branch from 8dfba8a to e08f418 Compare June 15, 2026 09:53
@ed-irl ed-irl force-pushed the ed-irl/integration-hooks branch from 3825398 to fb9a0e5 Compare June 19, 2026 01:07
@ed-irl ed-irl changed the title integration: Regenerate conflicted derived files on merge integration: Auto-rebuild integration branch on restack Jun 19, 2026
@ed-irl ed-irl force-pushed the ed-irl/integration-merge-drivers branch from 4b4fe32 to 40200ac Compare June 19, 2026 01:08
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.
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.

1 participant