()
| 29 | |
| 30 | |
| 31 | def _git_version(): |
| 32 | git = shutil.which("git") |
| 33 | if not git: |
| 34 | log.debug("Git not installed") |
| 35 | return False |
| 36 | ret = subprocess.run( |
| 37 | ["git", "--version"], |
| 38 | stdout=subprocess.PIPE, |
| 39 | check=False, |
| 40 | shell=False, |
| 41 | text=True, |
| 42 | ) |
| 43 | # On macOS, the git version is displayed in a different format |
| 44 | # git version 2.21.1 (Apple Git-122.3) |
| 45 | # As opposed to: |
| 46 | # git version 2.21.1 |
| 47 | version_str = ret.stdout.strip().split("(")[0].strip().split()[-1] |
| 48 | git_version = LooseVersion(version_str) |
| 49 | log.debug("Detected git version: %s", git_version) |
| 50 | return git_version |
| 51 | |
| 52 | |
| 53 | def _worktrees_supported(): |
no test coverage detected