fix: codegraph init
This commit is contained in:
@@ -16,7 +16,8 @@ class CodeGraphError(RuntimeError):
|
||||
class CodeGraphClient:
|
||||
async def prepare(self, workspace: Path) -> None:
|
||||
self._exclude_index(workspace)
|
||||
command = "sync" if (workspace / ".codegraph").is_dir() else "init"
|
||||
index = workspace / ".codegraph" / "codegraph.db"
|
||||
command = "sync" if index.is_file() else "init"
|
||||
started = monotonic()
|
||||
log.info(
|
||||
"CodeGraph index preparation started",
|
||||
|
||||
@@ -10,11 +10,12 @@ class FakeProcess:
|
||||
return b"", b""
|
||||
|
||||
|
||||
async def test_initializes_index_and_excludes_it_from_git(
|
||||
async def test_initializes_incomplete_index_and_excludes_it_from_git(
|
||||
tmp_path: Path, monkeypatch
|
||||
) -> None:
|
||||
workspace = tmp_path / "repo"
|
||||
(workspace / ".git" / "info").mkdir(parents=True)
|
||||
(workspace / ".codegraph").mkdir()
|
||||
calls: list[tuple[object, ...]] = []
|
||||
|
||||
async def create_subprocess_exec(*args, **_kwargs):
|
||||
@@ -38,6 +39,7 @@ async def test_syncs_an_existing_index_without_duplicating_exclude(
|
||||
workspace = tmp_path / "repo"
|
||||
(workspace / ".git" / "info").mkdir(parents=True)
|
||||
(workspace / ".codegraph").mkdir()
|
||||
(workspace / ".codegraph" / "codegraph.db").touch()
|
||||
exclude = workspace / ".git" / "info" / "exclude"
|
||||
exclude.write_text("# local excludes\n.codegraph/\n")
|
||||
calls: list[tuple[object, ...]] = []
|
||||
|
||||
Reference in New Issue
Block a user