Repository navigation
fix(cmd-version): stop upstream verification fetch from pruning the new release tag - #1510
Open
TiantianYZJ wants to merge 1 commit into
Open
TiantianYZJ wants to merge 1 commit into
TiantianYZJ wants to merge 1 commit into
Conversation
…ew release tag
A user's `fetch.pruneTags=true` git configuration (e.g. set globally
alongside `fetch.prune=true`) also applies to the upstream verification
fetch in `verify_upstream_unchanged()` when it uses the default
remote-configuration fetch path. That fetch removes every local tag
that is not on the remote yet - including the release tag created
earlier in the same `semantic-release version` run - so the subsequent
tag push fails with:
error: src refspec refs/tags/v1.0.0 does not match any
GitPushError: Failed to push tag (v1.0.0) to remote
Pass `--no-prune-tags` to both fetch variants so the verification fetch
never prunes tags regardless of the user's git configuration. The
authenticated-URL path (fetching with an explicit refspec) is unaffected
by pruneTags today; the flag makes the guarantee unconditional.
Fixes python-semantic-release#1509
This branch has not been deployed
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.
What
GitProject.verify_upstream_unchanged()now passes--no-prune-tagsto both of its fetch invocations: the default remote-configuration fetch and the authenticated-URL fetch with an explicit refspec.Why
Users with
fetch.pruneTags=truein their git configuration (e.g. set globally alongsidefetch.prune=true) lose the release tag duringsemantic-release version:git fetch origin(default path),fetch.pruneTags=trueprunes every local tag that does not exist on the remote yet — including the just-created release tag,error: src refspec refs/tags/v1.0.0 does not match any→GitPushError.Reported in #1509 (the user-side workaround was
git config --local remote.origin.pruneTags false). The verification fetch is a read-only consistency check and should never mutate local tags, so the flag is scoped to this fetch only; the user's own fetch behavior elsewhere is unchanged.Evidence
Reproduced at the git level (empty remote, local tag pointing to a local object):
fetch.prune=true+fetch.pruneTags=true, plaingit fetch origin--no-prune-tagsfetch.pruneTags=true(noprune)--no-prune-tagsTests
tests/unit/semantic_release/test_gitproject.py(17/17 pass): the default-path and authenticated-path assertions now expect--no-prune-tags; the fetch-failure test mocks the actual call site (repo.git.fetch).tests/unitrun: the failure/error set is identical with and without this change (23 pre-existing Windows-environment failures confirmed via a master baseline) — no new failures introduced.Fixes #1509