Skip to content

Commit f2f4fdf

Browse files
committed
fix: properly use GitPython subcommands
1 parent 1014646 commit f2f4fdf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/gitingest/clone.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
from pathlib import Path
66
from typing import TYPE_CHECKING
77

8-
from gitingest.config import DEFAULT_TIMEOUT
98
import git
9+
10+
from gitingest.config import DEFAULT_TIMEOUT
1011
from gitingest.utils.git_utils import (
1112
_add_token_to_url,
1213
check_repo_exists,
1314
checkout_partial_clone,
14-
create_git_auth_header,
1515
create_git_repo,
1616
ensure_git_installed,
1717
is_github_host,
@@ -97,19 +97,19 @@ async def clone_repo(config: CloneConfig, *, token: str | None = None) -> None:
9797
"no_checkout": True,
9898
"depth": 1,
9999
}
100-
100+
101101
if partial_clone:
102102
# GitPython doesn't directly support --filter and --sparse in clone
103103
# We'll need to use git.Git() for the initial clone with these options
104104
git_cmd = git.Git()
105-
cmd_args = ["clone", "--single-branch", "--no-checkout", "--depth=1"]
105+
cmd_args = ["--single-branch", "--no-checkout", "--depth=1"]
106106
if partial_clone:
107107
cmd_args.extend(["--filter=blob:none", "--sparse"])
108108
cmd_args.extend([clone_url, local_path])
109-
git_cmd.execute(cmd_args)
109+
git_cmd.clone(*cmd_args)
110110
else:
111111
git.Repo.clone_from(clone_url, local_path, **clone_kwargs)
112-
112+
113113
logger.info("Git clone completed successfully")
114114
except git.GitCommandError as exc:
115115
msg = f"Git clone failed: {exc}"
@@ -124,7 +124,7 @@ async def clone_repo(config: CloneConfig, *, token: str | None = None) -> None:
124124
# Create repo object and perform operations
125125
try:
126126
repo = create_git_repo(local_path, url, token)
127-
127+
128128
# Ensure the commit is locally available
129129
logger.debug("Fetching specific commit", extra={"commit": commit})
130130
repo.git.fetch("--depth=1", "origin", commit)

src/gitingest/utils/git_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ async def checkout_partial_clone(config: CloneConfig, token: str | None) -> None
368368

369369
try:
370370
repo = create_git_repo(config.local_path, config.url, token)
371-
repo.git.execute(["sparse-checkout", "set", subpath])
371+
repo.git.sparse_checkout("set", subpath)
372372
except git.GitCommandError as exc:
373373
msg = f"Failed to configure sparse-checkout: {exc}"
374374
raise RuntimeError(msg) from exc

0 commit comments

Comments
 (0)