Skip to content

Commit eb593e5

Browse files
authored
Merge branch 'main' into chore/modernize-code-style
2 parents b034a91 + 75ee8f7 commit eb593e5

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

src/gitingest/clone.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class CloneConfig:
1414
branch: str | None = None
1515

1616

17+
1718
async def check_repo_exists(url: str) -> bool:
1819
"""
1920
Check if a repository exists at the given URL using an HTTP HEAD request.
@@ -44,6 +45,7 @@ async def check_repo_exists(url: str) -> bool:
4445

4546

4647
async def run_git_command(*args: str) -> tuple[bytes, bytes]:
48+
4749
"""
4850
Executes a git command asynchronously and captures its output.
4951
@@ -109,6 +111,7 @@ async def clone_repo(config: CloneConfig) -> tuple[bytes, bytes]:
109111
commit: str | None = config.commit
110112
branch: str | None = config.branch
111113

114+
112115
if not url:
113116
raise ValueError("The 'url' parameter is required.")
114117

@@ -131,6 +134,7 @@ async def clone_repo(config: CloneConfig) -> tuple[bytes, bytes]:
131134
return await run_git_command(*checkout_cmd)
132135

133136
if branch and branch.lower() not in ("main", "master"):
137+
134138
# Scenario 2: Clone a specific branch with shallow depth
135139
clone_cmd = ["git", "clone", "--depth=1", "--single-branch", "--branch", branch, url, local_path]
136140
return await run_git_command(*clone_cmd)

src/gitingest/ingest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def ingest(
1515
exclude_patterns: list[str] | str | None = None,
1616
output: str | None = None,
1717
) -> tuple[str, str, str]:
18+
1819
try:
1920
query = parse_query(
2021
source=source,
@@ -27,7 +28,7 @@ def ingest(
2728

2829
# Extract relevant fields for CloneConfig
2930
clone_config = CloneConfig(
30-
url=f"https://github.com/{query['slug']}.git",
31+
url=query["url"],
3132
local_path=query["local_path"],
3233
commit=query.get("commit"),
3334
branch=query.get("branch"),

src/gitingest/parse_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def parse_url(url: str) -> dict[str, Any]:
6161

6262
# Handle branch names with slashes and special characters
6363

64-
# Find the index of the first type indicator ('tree' or 'blob'), if any
64+
# Find the index of the first type indicator ("tree" or "blob"), if any
6565
type_indicator_index = next((i for i, part in enumerate(remaining_parts) if part in ("tree", "blob")), None)
6666

6767
if type_indicator_index is None:

src/gitingest/tests/test_clone.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ async def test_clone_repo_with_commit() -> None:
1616

1717
with patch("gitingest.clone.check_repo_exists", return_value=True) as mock_check:
1818
with patch("gitingest.clone.run_git_command", new_callable=AsyncMock) as mock_exec:
19+
1920
mock_process = AsyncMock()
2021
mock_process.communicate.return_value = (b"output", b"error")
2122
mock_exec.return_value = mock_process

src/process_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def process_query(
6161
ignore_patterns=exclude_patterns,
6262
)
6363
clone_config = CloneConfig(
64-
url=f"https://github.com/{query['slug']}.git",
64+
url=query["url"],
6565
local_path=query["local_path"],
6666
commit=query.get("commit"),
6767
branch=query.get("branch"),

0 commit comments

Comments
 (0)