Add scripts/post-sync.sh hook support#1
Merged
Conversation
Contributor
Author
|
Companion PR opened on migtools/mta-kai consuming this hook: migtools/mta-kai#4 |
After a successful merge (or submodule update), each managed repo's scripts/post-sync.sh runs if present and executable. Use it to regenerate files derived from upstream content (e.g. hash-locked requirements.txt for Hermeto/Konflux builds). Tracked-file changes are committed as "post-sync: regenerate generated files for <branch>"; honors --no-commit. Non-zero exit fails the repo and skips the push. Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
Git ships the `ours` merge strategy (git merge -s ours) but not the matching per-file driver, so `.gitattributes` lines like `some-file merge=ours` silently fall back to the default 3-way merge unless the clone has `git config merge.ours.driver true`. Set it up during clone so overlays paired with post-sync.sh work out of the box. Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
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.
After a successful merge (or submodule update), each managed repo's
scripts/post-sync.shruns if present and executable. Use it to regenerate files derived from upstream content — e.g. hash-lockedrequirements.txtfor Hermeto/Konflux builds, or other midstream-specific build artifacts. Tracked-file changes are committed aspost-sync: regenerate generated files for <branch>; honors--no-commit. Non-zero exit fails the repo and skips the push.Mirrored in
sync-and-merge.shandsync-and-rebase.sh.Motivating use case
migtools/mta-kai needs its
kai_mcp_solution_server/requirements.txtto be hash-locked for Hermeto's pip backend (KONFLUX-14150, openshift-eng/art-tools#3047). Upstream konveyor/kai keeps an unhasheduv pip freeze-style file. With this hook, mta-kai ships a.gitattributes merge=oursrule forrequirements.txtplus ascripts/post-sync.shthat regenerates the hash-locked file from the newly-mergedpyproject.toml— so dep bumps upstream propagate to the Hermeto-compatible file automatically rather than silently going stale.Companion PR opening shortly on migtools/mta-kai.