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