From 0776c3a4db5cbba169d8b780bdecb4d7a295a52d Mon Sep 17 00:00:00 2001
From: Andrei Neculau <andrei.neculau@gmail.com>
Date: Tue, 14 Jan 2025 19:48:35 +0100
Subject: [PATCH] fetch tags when fetch-depth > 0. fix #1781

---
 src/git-command-manager.ts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts
index 8e42a387f..40ca7e07a 100644
--- a/src/git-command-manager.ts
+++ b/src/git-command-manager.ts
@@ -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')
+    } else {
+      if (!refSpec.some(x => x === refHelper.tagsRefSpec)) {
+        args.push('--no-tags')
+      }
     }
 
     args.push('--prune', '--no-recurse-submodules')