Repository navigation
fix(repo-walker): overwrite moved tags on pull - #5
Merged
Merged
Conversation
With fetch.pruneTags set, every fetch carries a non-forced refs/tags/*:refs/tags/* refspec. When upstream re-points a tag, as github-workflows does with its floating v3-style tags, the fetch rejects it as "would clobber existing tag" and the whole pull fails, so my-repos reports the repo as failed and leaves it behind. Pass --force to the pull so the fetch may overwrite the local tag. --ff-only still guards the branch: a diverged or rewritten branch is still refused and left where it was. Two walk tests cover it: one moves a tag upstream and checks the walk pulls and updates the tag, the other diverges the branch and checks the pull still fails for that reason and not the tag. Both fail without the fix. Closes smartwatermelon/github-workflows#189
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.
Summary
my-reposfailed to pull any repo whose upstream had moved a tag. github-workflows moves its floatingv3-style tags on every release, so it hit this each time.The cause is
fetch.pruneTags = truein the global git config. That setting adds a non-forcedrefs/tags/*:refs/tags/*refspec to every fetch, and git refuses to move an existing tag through a non-forced refspec:! [rejected] v3 -> v3 (would clobber existing tag). WithoutpruneTags, tag auto-follow never touches a tag that already exists, which is why the plain case looks fine.The walker now runs
git pull --ff-only --force. The--forcereaches the fetch, so the local tag is overwritten (t [tag update] v3 -> v3).--ff-onlystill decides what happens to the branch, so a diverged or force-pushed branch is still refused.This is the only pull/fetch site in
lib/repo-walker.sh.Tests
Two new walk tests in
tests/repo-walker.bats. Each builds a local bare upstream and setsfetch.pruneTagson the walked clone so the result doesn't depend on whoever runs it:Both fail without the fix. All 85 tests in the file pass with it, and they also pass with
GIT_CONFIG_GLOBAL=/dev/null.Closes smartwatermelon/github-workflows#189