Skip to content

Commit e16b561

Browse files
Fix Windows compatibility: subprocess support and long path handling
1 parent 2f447ae commit e16b561

File tree

9 files changed

+506
-1
lines changed

9 files changed

+506
-1
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/dbnavigator.xml

Lines changed: 427 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gitingest.iml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gitingest/utils/git_utils.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import asyncio
66
import base64
77
import re
8+
import sys
89
from urllib.parse import urlparse
910

1011
from gitingest.utils.exceptions import InvalidGitHubTokenError
@@ -67,17 +68,26 @@ async def run_command(*args: str) -> tuple[bytes, bytes]:
6768
async def ensure_git_installed() -> None:
6869
"""Ensure Git is installed and accessible on the system.
6970
71+
On Windows, this also enables support for long file paths via
72+
`git config --system core.longpaths true`.
73+
7074
Raises
7175
------
7276
RuntimeError
73-
If Git is not installed or not accessible.
77+
If Git is not installed or not accessible, or if enabling long paths fails.
7478
7579
"""
7680
try:
7781
await run_command("git", "--version")
7882
except RuntimeError as exc:
7983
msg = "Git is not installed or not accessible. Please install Git first."
8084
raise RuntimeError(msg) from exc
85+
if sys.platform == "win32":
86+
try:
87+
await run_command("git", "config", "--system", "core.longpaths", "true")
88+
except RuntimeError as exc:
89+
msg = "Failed to enable long paths. You may need to run the app as Administrator."
90+
raise RuntimeError(msg) from exc
8191

8292

8393
async def check_repo_exists(url: str, token: str | None = None) -> bool:

0 commit comments

Comments
 (0)