summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorL. E. Segovia <amy@centricular.com>2024-04-12 18:04:49 -0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-04-14 06:35:14 +0000
commite115e6b5d1bcaed7e0c964d506185a01f3d3ce86 (patch)
tree80b3337468e625d867cca5df35b77f77b732a9e7
parent1d87ade07b66100c60fbdff40570db13bd2604d1 (diff)
git: Block usage of the MSYS2 Git under Windows
Our current setup for calling Git means that MSYS2 Git will be preferred to Windows Git. MSYS2 Git can process repositories cloned by Windows Git, but not the other way around. This also breaks Cargo's parsing of .git, if patches are applied (as they trigger the creation of a local clone). See: https://lore.kernel.org/git/01cf64db-2ff5-4be5-8968-d280ab0ffc50@kdbg.org/ Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1451>
-rw-r--r--cerbero/utils/git.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cerbero/utils/git.py b/cerbero/utils/git.py
index 195d68fd..9223c519 100644
--- a/cerbero/utils/git.py
+++ b/cerbero/utils/git.py
@@ -17,6 +17,7 @@
# Boston, MA 02111-1307, USA.
import os
+import shutil
import time
import cerbero.utils.messages as m
@@ -24,8 +25,11 @@ from cerbero.config import Platform
from cerbero.utils import shell, _
from cerbero.errors import FatalError
-
-GIT = 'git'
+if shell.PLATFORM == Platform.WINDOWS:
+ # We do not want the MSYS2 Git because it mucks consumption by Cargo
+ GIT = shutil.which('git', path=shell.get_path_minus_msys(os.environ['PATH']))
+else:
+ GIT = 'git'
def ensure_user_is_set(git_dir, logfile=None):