Skip to content

fix(git): match remote tags by full ref instead of suffix - #2387

Merged
beeequeue merged 2 commits into
changesets:mainfrom
mixelburg:fix/remote-tag-exists-suffix-match
Nov 20, 2026
Merged

beeequeue merged 2 commits into
changesets:mainfrom
mixelburg:fix/remote-tag-exists-suffix-match

Conversation

@mixelburg

Copy link
Copy Markdown
Contributor

Summary

Closes #2386.

remoteTagExists passes the tag name to git ls-remote as a bare pattern. git ls-remote matches such a pattern against the tail of the ref name, so shacl-playground@2.0.0 also matched refs/tags/@zazuko/shacl-playground@2.0.0. When a monorepo publishes a scoped package whose tag ends with an unscoped package's tag, splitByTagStatus counts the unscoped release as already tagged on the remote and skips its git tag, leaving the release untagged in git while the package is published.

Matching refs/tags/<tag> instead only returns the exact ref:

$ git ls-remote --tags origin 'shacl-playground@2.0.0'
524e4908...  refs/tags/@zazuko/shacl-playground@2.0.0   # before
$ git ls-remote --tags origin 'refs/tags/shacl-playground@2.0.0'
                                                        # after, no exact tag exists

Changes

  • remoteTagExists(tagStr, cwd) matches the full ref and takes the repo directory, like tagExists and the other helpers in @changesets/git. The call site in splitByTagStatus already has cwd on hand.
  • Drops the stray -l flag, which ls-remote does not take (git tag -l does).
  • Regression test creates an @scope/pkg@1.0.0 tag on a fixture remote and asserts pkg@1.0.0 is not reported as existing, then that it is once the exact tag is added.

Verification

  • packages/git/src/index.test.ts: 37/37 pass; the new test fails on main (expected true to be false) and passes with the change.
  • packages/cli: publish-plan and utils suites 26/26 pass.
  • tsc, eslint, oxfmt --check clean.

Changeset is a patch for @changesets/git and @changesets/cli.

`git ls-remote --tags origin <pattern>` treats a pattern without a leading
`refs/` as a suffix to match against the tail of the ref name, so looking for
`shacl-playground@2.0.0` also found `refs/tags/@zazuko/shacl-playground@2.0.0`
and the release was considered already tagged on the remote.

Matching against `refs/tags/<tag>` only returns the exact tag. The tag lookup
now also takes the repo directory like the other helpers in the package.
@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fcae2fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@changesets/cli Patch
@changesets/git Patch
@changesets/apply-release-plan Patch
@changesets/read Patch
@changesets/release-utils Patch
@changesets/get-release-plan Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

👷 Deploy request for changesets pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit fcae2fd

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.65%. Comparing base (9a035ec) to head (fcae2fd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2387      +/-   ##
==========================================
+ Coverage   87.47%   87.65%   +0.17%     
==========================================
  Files          78       78              
  Lines        2971     2972       +1     
  Branches      851      853       +2     
==========================================
+ Hits         2599     2605       +6     
+ Misses        337      332       -5     
  Partials       35       35              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread .changeset/quiet-donkeys-search.md Resolved
@beeequeue
beeequeue added this pull request to the merge queue Nov 20, 2026
Merged via the queue into changesets:main with commit 06548ad Nov 20, 2026
15 checks passed
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.

Private package tags skipped when remote lookup matches a scoped package tag

2 participants