Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch tags when fetch-depth > 0. fix #1781 #2039

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/git-command-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,12 @@ class GitCommandManager {
}
): Promise<void> {
const args = ['-c', 'protocol.version=2', 'fetch']
if (!refSpec.some(x => x === refHelper.tagsRefSpec) && !options.fetchTags) {
args.push('--no-tags')
if (options.fetchTags) {
args.push('--tags')
Copy link
Member

Choose a reason for hiding this comment

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

this won't work.
the bug in git cause the --tags get ignored when we pass any refspec.

19:38:51.501221 git.c:476               trace: built-in: git fetch --prune --no-recurse-submodules --depth=1 --tags origin +dafa907d050b7aca612cb1fc3262cbe1157a41d4:refs/remotes/origin/main
From https://github.com/TingluoHuang/repo-3208316
 + 2e53bff...dafa907 dafa907d050b7aca612cb1fc3262cbe1157a41d4 -> origin/main  (forced update)

vs older git version

19:45:56.613886 git.c:479               trace: built-in: git fetch --prune --no-recurse-submodules --depth=1 --tags origin +dafa907d050b7aca612cb1fc3262cbe1157a41d4:refs/remotes/origin/main
From https://github.com/TingluoHuang/repo-3208316
 + 5b6b8cc...dafa907 dafa907d0[50](https://github.com/TingluoHuang/repo-3208316/actions/runs/13315815917/job/37189415774#step:4:51)b7aca612cb1fc3262cbe1157a41d4 -> origin/main  (forced update)
 * [new tag]         v13315501148                             -> v13315501148
 * [new tag]         v13315557600                             -> v13315557600
 * [new tag]         v13315584914                             -> v13315584914
 * [new tag]         v13315601791                             -> v13315601791
 * [new tag]         v133156378[52](https://github.com/TingluoHuang/repo-3208316/actions/runs/13315815917/job/37189415774#step:4:53)                             -> v13315637852
 * [new tag]         v13315718561                             -> v13315718561
 * [new tag]         v13315732428                             -> v13315732428
 * [new tag]         v13315782509                             -> v13315782509

} else {
if (!refSpec.some(x => x === refHelper.tagsRefSpec)) {
args.push('--no-tags')
}
}

args.push('--prune', '--no-recurse-submodules')
Expand Down