[PATCH v2 1/2] git: only fetch requested tag

1 view
Skip to first unread message

Felix Moessbauer

unread,
May 17, 2024, 10:48:24 AMMay 17
to kas-...@googlegroups.com, jan.k...@siemens.com, ch...@wiggins.nz, Felix Moessbauer
On git clones, the fetching of tags need to be explicitly requested.
When requesting to fetch a tag, we previously fetched all tags and just
checked out the needed one. However, it is sufficient to only fetch the
requested one.

This is a preparation to support shallow clones.

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
kas/repos.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kas/repos.py b/kas/repos.py
index 62b2bbd75..4b2b0c3e5 100644
--- a/kas/repos.py
+++ b/kas/repos.py
@@ -544,7 +544,7 @@ class GitRepo(RepoImpl):
def fetch_cmd(self):
cmd = ['git', 'fetch', '-q']
if self.tag:
- cmd.append('--tags')
+ cmd.extend(['origin', f'+{self.tag}:refs/tags/{self.tag}'])

branch = self.branch or self.refspec
if branch and branch.startswith('refs/'):
--
2.39.2

Reply all
Reply to author
Forward
0 new messages