Coverage for app/venv/lib/python3.14/site-packages/weblate/gitexport/utils.py: 80%
13 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
1# Copyright © Michal Čihař <michal@weblate.org>
2#
3# SPDX-License-Identifier: GPL-3.0-or-later
5import subprocess
6from functools import cache as functools_cache
8from django.core.management.utils import find_command
10GIT_PATHS = [
11 "/usr/lib/git",
12 "/usr/lib/git-core",
13 "/usr/libexec/git",
14 "/usr/libexec/git-core",
15]
18@functools_cache
19def find_git_http_backend():
20 """Find Git HTTP back-end."""
21 try:
22 path = subprocess.run(
23 ["git", "--exec-path"],
24 text=True,
25 check=True,
26 capture_output=True,
27 ).stdout.strip()
28 if path: 28 ↛ 33line 28 didn't jump to line 33 because the condition on line 28 was always true
29 GIT_PATHS.insert(0, path)
30 except OSError:
31 pass
33 return find_command("git-http-backend", path=GIT_PATHS)