[cd] Stop fetching all tags when searching for ancestor tag#94302
Merged
Conversation
A normal checkout during release is a shallow clone with the last 25 commits. 25 commits can be too shallow to find the parent commit. We used to deepen to 1k to increase chances of finding a tag. However, we were also fetching **all** tags. This is wasteful in a default config that auto-follows tags i.e. by default, Git already includes the tags in the commits it fetches. So if there was a tag in the clone depth, it was included. Deepening a clone is also expensive. That's why you should only use shallow clones in CI and never locally where you commonly need to deepen. Now we always clone with a depth of 1000 immediately.
Contributor
Stats cancelledCommit: 4a65b7d |
Contributor
Tests PassedCommit: 4a65b7d |
bgw
approved these changes
Jun 1, 2026
This was referenced Jun 2, 2026
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.
A normal checkout during release is a shallow clone with the last 25 commits. 25 commits can be too shallow to find the closest ancestor tag.
We used to deepen to 1k to increase chances of finding a tag. However, we were also fetching all tags.
This is wasteful in a default config that auto-follows tags i.e. by default, Git already includes the tags in the commits it fetches. So if there was a tag in the clone depth, it was included. Deepening a clone is also expensive. That's why you should only use shallow clones in CI and never locally where you commonly need to deepen.
Now we always clone with a depth of 1000 immediately.
test plan
cherry-picked to branch that won't do any mutative actions: https://github.com/vercel/next.js/actions/runs/26754284162/job/78849950644
Clone with 1000 depth is around 20-25s. Deepen +
--tagsis ~120s (https://github.com/vercel/next.js/actions/runs/26697902192/job/78685430123#step:7:1)