From 44bee91053e1abe1e95b6bca5bca97932138f558 Mon Sep 17 00:00:00 2001 From: Nemo Date: Tue, 5 Aug 2025 16:22:14 +0530 Subject: [PATCH] [git] Add a user-agent to git clone (#487) Following #474, also use the endoflife.date user agent when cloning git repositories. --- src/common/git.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/git.py b/src/common/git.py index 4d85f8c7..cfbfa7c4 100644 --- a/src/common/git.py +++ b/src/common/git.py @@ -3,6 +3,8 @@ from hashlib import sha1 from pathlib import Path from subprocess import run +from . import http + class Git: """Git cli wrapper @@ -39,6 +41,7 @@ class Git: """Fetch and return tags matching the given`pattern`""" # See https://stackoverflow.com/a/65746233/374236 self._run("config --local extensions.partialClone true") + self._run(f"config --local http.userAgent '{http.ENDOFLIFE_BOT_USER_AGENT}'") # Using --force to avoid error like "would clobber existing tag". # See https://stackoverflow.com/questions/58031165/how-to-get-rid-of-would-clobber-existing-tag. self._run("fetch --force --tags --filter=blob:none --depth=1 origin")