fix(inkless-sync): use trunk merge base for --before-version - #770
Merged
Conversation
main-sync.sh --before-version resolved the sync target from a version tag, then took its parent commit. Release tags and branches such as apache/4.3 can carry backports and fixes that never land on apache/trunk. Resolving from the tag pulled those release-only commits into the trunk sync, mixing history that does not belong there. Resolve the target as the merge base of apache/trunk and apache/$BEFORE_VERSION instead, so the sync only replays commits that are genuinely part of trunk history up to where the release branch diverged. tag_exists() used git rev-parse on the bare ref, so it matched branches as well as tags, which let a mistyped or branch-only argument pass validation. It now checks refs/tags/<ref> specifically. Added branch_exists(), checking refs/heads/ and refs/remotes/, and use it in main-sync.sh to validate apache/$BEFORE_VERSION as a branch, since --before-version now expects a release branch rather than a tag. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes inkless-sync/main-sync.sh --before-version so it targets the correct upstream point on apache/trunk by using the merge base between apache/trunk and the specified release branch (for example, apache/4.3), avoiding release-only backports that never landed on trunk.
Changes:
- Change
--before-versiontargeting from “parent of version tag” togit merge-base apache/trunk apache/<version-branch>. - Tighten ref validation:
tag_exists()now verifiesrefs/tags/<tag>specifically, and a newbranch_exists()validates local or remote-tracking branches. - Update
inkless-sync/README.mdand script help text to match the new semantics (“diverged from trunk”).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| inkless-sync/README.md | Updates documentation to describe the new --before-version behavior (merge base with trunk). |
| inkless-sync/main-sync.sh | Switches --before-version resolution to trunk/release-branch merge base and validates the release branch exists. |
| inkless-sync/lib/common.sh | Makes tag_exists() tag-specific and adds branch_exists() for branch validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jeqo
reviewed
Aug 26, 2026
jeqo
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Added a few doc/logging suggestions
jeqo
approved these changes
Aug 27, 2026
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.
main-sync.sh --before-version resolved the sync target from a version tag, then took its parent commit. Release tags and branches such as apache/4.3 can carry backports and fixes that never land on apache/trunk. Resolving from the tag pulled those release-only commits into the trunk sync, mixing history that does not belong there.
Resolve the target as the merge base of apache/trunk and apache/$BEFORE_VERSION instead, so the sync only replays commits that are genuinely part of trunk history up to where the release branch diverged.
tag_exists() used git rev-parse on the bare ref, so it matched branches as well as tags, which let a mistyped or branch-only argument pass validation. It now checks refs/tags/ specifically. Added branch_exists(), checking refs/heads/ and refs/remotes/, and use it in main-sync.sh to validate apache/$BEFORE_VERSION as a branch, since --before-version now expects a release branch rather than a tag.