Skip to content

Commit 40b91f0

Browse files
codeflash suggestions
1 parent b6f6661 commit 40b91f0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

codeflash/code_utils/git_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,16 @@ def remove_worktree(worktree_dir: Path) -> None:
270270

271271

272272
def get_patches_dir_for_project() -> Path:
273-
project_id = get_git_project_id() or ""
274-
return Path(patches_dir / project_id)
273+
project_id = get_git_project_id()
274+
return patches_dir / project_id
275275

276276

277277
def get_patches_metadata() -> dict[str, Any]:
278278
project_patches_dir = get_patches_dir_for_project()
279279
meta_file = project_patches_dir / "metadata.json"
280280
if meta_file.exists():
281-
return json.loads(meta_file.read_text())
281+
with meta_file.open("r", encoding="utf-8") as f:
282+
return json.load(f)
282283
return {"id": get_git_project_id() or "", "patches": []}
283284

284285

codeflash/lsp/beta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ def on_patch_applied(_server: CodeflashLanguageServer, params: OnPatchAppliedPar
244244
continue
245245
new_patches.append(patch)
246246

247-
overwrite_patch_metadata(new_patches)
248247
# then remove the patch file
249248
if deleted_patch_file:
249+
overwrite_patch_metadata(new_patches)
250250
patch_path = Path(deleted_patch_file)
251251
patch_path.unlink(missing_ok=True)
252252
return {"status": "success"}

0 commit comments

Comments
 (0)