Skip to content

fix(core): use existing patch tags as patch-counter anchor on release…#87

Open
denis-markushin wants to merge 1 commit into
mainfrom
bigfix/make-release-patch
Open

fix(core): use existing patch tags as patch-counter anchor on release…#87
denis-markushin wants to merge 1 commit into
mainfrom
bigfix/make-release-patch

Conversation

@denis-markushin
Copy link
Copy Markdown
Collaborator

@denis-markushin denis-markushin commented May 17, 2026

… branches

Previously calcVersionInRelease derived the patch number purely from the commit distance between the release branch and the default main branch. That approach breaks the moment a release branch is merged back into main: the merge brings every release-branch commit into main's history, shifting the merge-base forward and silently lowering the computed patch number to a value that has already been released. The next makeRelease / publish attempt then tries to re-create an existing tag and fails.

This change uses v<major>.<minor>.<patch> tags reachable from HEAD as the authoritative anchor when they exist: the patch number becomes latest_tag_patch + commits_since_that_tag. Both annotated and lightweight tags are honoured; tags that do not sit on the release branch's history are ignored. When no matching tags exist yet the calculation falls back to the original distance-from-main behaviour, so existing projects that have never tagged a patch release see no change.

Closes: #86

… branches

Previously `calcVersionInRelease` derived the patch number purely from the commit
distance between the release branch and the default main branch. That approach
breaks the moment a release branch is merged back into main: the merge brings
every release-branch commit into main's history, shifting the merge-base
forward and silently lowering the computed patch number to a value that has
already been released. The next `makeRelease` / publish attempt then tries to
re-create an existing tag and fails.

This change uses `v<major>.<minor>.<patch>` tags reachable from HEAD as the
authoritative anchor when they exist: the patch number becomes
`latest_tag_patch + commits_since_that_tag`. Both annotated and lightweight
tags are honoured; tags that do not sit on the release branch's history are
ignored. When no matching tags exist yet the calculation falls back to the
original distance-from-main behaviour, so existing projects that have never
tagged a patch release see no change.
"${releases.releaseBranches}"
)

// Prefer existing patch tags when present: they are an authoritative record of what has
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Unfortunately I do not like the way of making any calculation based on tags. There are a lot of tools who do this already. We need to think wisely if we really want to be a yet another tool which depends on tags.

#86 (comment)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We had a lot of problems with those tools. A lot of CI/release systems add their tags (for example GitHub) and that affects the work of those instruments :(

That's why I have chosen release/* branches and the distance from main/master branch

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.

makeRelease PATCH re-creates the previous tag when the release branch has been merged back into main

2 participants