Repository navigation
fix(gitter): fetch all tags and prune deleted refs - #6217
Open
nemmy-ballistix wants to merge 2 commits into
Open
nemmy-ballistix wants to merge 2 commits into
nemmy-ballistix wants to merge 2 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
A plain `git fetch origin` only follows tags that point into fetched branch history, so a project that tags releases on commits outside every branch (php-src does) gets no new tags after the initial clone. Fetch all tags, let moved tags update, and prune branches and tags that were deleted upstream so the clone stays in sync with the remote.
nemmy-ballistix
force-pushed
the
fix/cve5-new-release-tags
branch
from
October 24, 2026 17:56
eb4c738 to
2d63150
Compare
Ly-Joey
previously approved these changes
Oct 27, 2026
Ly-Joey
left a comment
Contributor
There was a problem hiding this comment.
Thank! Just one nit on the helper function.
Comment on lines
+52
to
+61
| git := func(dir string, args ...string) string { | ||
| t.Helper() | ||
| args = append([]string{"-c", "user.name=Test", "-c", "[email protected]"}, args...) | ||
| out, err := runCmd(ctx, dir, nil, "git", args...) | ||
| if err != nil { | ||
| t.Fatalf("git %v failed: %v", args, err) | ||
| } | ||
|
|
||
| return strings.TrimSpace(string(out)) | ||
| } |
Contributor
There was a problem hiding this comment.
There is an existing test helper function runGit(), you might want to reuse that?
Author
There was a problem hiding this comment.
Done, thanks. The test now uses runGit for the setup.
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.
Overview
Related to #6216
gitter refreshes its clones with a plain
git fetch origin. That only follows tags that point into fetched branch history, so a repo that tags releases on commits no branch contains (php-src does) gets no new tags after the initial clone. Tags moved upstream aren't updated either, and branches and tags deleted upstream are never removed.fetchReponow runsgit fetch --tags --prune --prune-tags --force origin:--tagsfetches every tag, including tags on commits no branch contains.--forceupdates a tag that was moved upstream instead of failing the fetch.--pruneand--prune-tagsremove branches and tags that were deleted upstream.Existing clones catch up on their next fetch, with no reclone. Because gitter builds its commit graph from
git log --all, commits reachable only from a deleted branch or tag drop out of the graph on the next load.This doesn't fix affected commit enumeration for php-src, which #6221 tracks. The vulnfeeds change from the first version of this PR will follow in a separate PR.
Testing
TestFetchRepo_SyncsTagsAndBranchesclones a local upstream repo, then adds a tag no branch contains, moves a tag, deletes a tag and deletes a branch upstream. It checks thatfetchRepobrings the clone in line with all four. With master's fetch, all four checks fail. With--tags --forcealone, the two prune checks fail.go vet,gofmtand golangci-lint are clean. The same seven network-dependent handler tests fail on master and on this branch, for exampleTestTagsHandlergets a 404 instead of a 403 from a live remote.AI tools assisted with the investigation and the code. I reviewed the changes and the test results and stand behind them.