Skip to content

fix(inkless-sync): use trunk merge base for --before-version - #770

Merged
jeqo merged 2 commits into
mainfrom
tvainika/fix-main-sync-before-version
Aug 27, 2026
Merged

fix(inkless-sync): use trunk merge base for --before-version#770
jeqo merged 2 commits into
mainfrom
tvainika/fix-main-sync-before-version

Conversation

@tvainika

Copy link
Copy Markdown
Member

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.

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-version targeting from “parent of version tag” to git merge-base apache/trunk apache/<version-branch>.
  • Tighten ref validation: tag_exists() now verifies refs/tags/<tag> specifically, and a new branch_exists() validates local or remote-tracking branches.
  • Update inkless-sync/README.md and 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.

@tvainika
tvainika requested a review from jeqo August 26, 2026 11:08

@jeqo jeqo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Added a few doc/logging suggestions

Comment thread inkless-sync/README.md Outdated
Comment thread inkless-sync/README.md
Comment thread inkless-sync/README.md Outdated
Comment thread inkless-sync/main-sync.sh Outdated
@tvainika
tvainika requested a review from jeqo August 27, 2026 04:18
@jeqo
jeqo merged commit b40ea3e into main Aug 27, 2026
5 checks passed
@jeqo
jeqo deleted the tvainika/fix-main-sync-before-version branch August 27, 2026 06:13
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.

3 participants