This commit is contained in:
Steven Van Ingelgem 2025-11-03 20:51:55 +01:00 committed by GitHub
commit e2cf98d5fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 248 additions and 5 deletions

View file

@ -285,8 +285,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')
const hasTagsRefSpec = refSpec.some(x => x === refHelper.tagsRefSpec)
const needsSeparateTagFetch = this.gitVersion.toString().startsWith('2.48') && options.fetchTags && !hasTagsRefSpec
if (!hasTagsRefSpec) {
// For git 2.48, skip --tags here if we need separate fetch
args.push(needsSeparateTagFetch || !options.fetchTags ? '--no-tags' : '--tags')
}
args.push('--prune', '--no-recurse-submodules')
@ -317,6 +321,19 @@ class GitCommandManager {
await retryHelper.execute(async () => {
await that.execGit(args)
})
// Separate tag fetch for git 2.48
if (needsSeparateTagFetch) {
const tagArgs = ['-c', 'protocol.version=2', 'fetch', '--tags', '--prune']
if (options.showProgress) {
tagArgs.push('--progress')
}
tagArgs.push('origin')
await retryHelper.execute(async () => {
await that.execGit(tagArgs)
})
}
}
async getDefaultBranch(repositoryUrl: string): Promise<string> {