|
4 | 4 |
|
5 | 5 | import asyncio |
6 | 6 | import base64 |
7 | | -import ctypes |
8 | 7 | import os |
9 | 8 | import re |
10 | 9 | from typing import Final |
@@ -105,20 +104,18 @@ async def ensure_git_installed() -> None: |
105 | 104 | raise RuntimeError(msg) from exc |
106 | 105 | if sys.platform == "win32": |
107 | 106 | try: |
108 | | - if ctypes.windll.shell32.IsUserAnAdmin(): |
109 | | - stdout, _ = await run_command("git", "config", "--system", "core.longpaths") |
110 | | - if stdout.decode().strip().lower() == "true": |
111 | | - return |
| 107 | + stdout, _ = await run_command("git", "config", "--global", "core.longpaths") |
| 108 | + if stdout.decode().strip().lower() != "true": |
| 109 | + print( |
| 110 | + f"{Colors.BROWN}WARN{Colors.END}: {Colors.RED}Git clone may fail on Windows " |
| 111 | + f"due to long file paths:{Colors.END}", |
| 112 | + ) |
| 113 | + print(f"{Colors.RED}To avoid this issue, consider enabling long path support with:{Colors.END}") |
| 114 | + print(f"{Colors.RED} git config --system core.longpaths true{Colors.END}") |
| 115 | + print(f"{Colors.RED}Note: This command may require administrator privileges.{Colors.END}") |
112 | 116 | except RuntimeError: |
113 | | - # Ignore if checking 'core.longpaths' fails due to lack of administrator rights. |
| 117 | + # Ignore if checking 'core.longpaths' fails. |
114 | 118 | pass |
115 | | - print( |
116 | | - f"{Colors.BROWN}WARN{Colors.END}: {Colors.RED}Git clone may fail on Windows " |
117 | | - f"due to long file paths:{Colors.END}", |
118 | | - ) |
119 | | - print(f"{Colors.RED}To avoid this issue, consider enabling long path support with:{Colors.END}") |
120 | | - print(f"{Colors.RED} git config --system core.longpaths true{Colors.END}") |
121 | | - print(f"{Colors.RED}Note: This command may require administrator privileges.{Colors.END}") |
122 | 119 |
|
123 | 120 |
|
124 | 121 | async def check_repo_exists(url: str, token: str | None = None) -> bool: |
|
0 commit comments