Skip to content

Commit f400432

Browse files
keep path type
1 parent 85a8477 commit f400432

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

codeflash/optimization/optimizer.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -452,42 +452,38 @@ def mirror_paths_for_worktree_mode(self, worktree_dir: Path) -> None:
452452
self.original_args_and_test_cfg = (original_args, original_test_cfg)
453453

454454
original_module_root = original_args.module_root
455-
original_git_root = git_root_dir().as_posix()
455+
original_git_root = git_root_dir()
456456

457457
# mutate project_root
458-
relative_project_root = original_args.project_root.relative_to(original_git_root).as_posix()
458+
relative_project_root = original_args.project_root.relative_to(original_git_root)
459459
# this will be the same as the original project root but in the worktree
460460
new_project_root = worktree_dir / relative_project_root
461461
self.args.project_root = new_project_root
462462
self.test_cfg.project_root_path = new_project_root
463463

464464
# mutate module_root
465-
relative_module_root = original_module_root.relative_to(original_git_root).as_posix()
465+
relative_module_root = original_module_root.relative_to(original_git_root)
466466
self.args.module_root = worktree_dir / relative_module_root
467467

468468
# mute target file
469-
relative_optimized_file = (
470-
original_args.file.relative_to(original_git_root).as_posix() if original_args.file else None
471-
)
469+
relative_optimized_file = original_args.file.relative_to(original_git_root) if original_args.file else None
472470
if relative_optimized_file is not None:
473471
self.args.file = worktree_dir / relative_optimized_file
474472

475473
# mutate tests root
476-
relative_tests_root = original_test_cfg.tests_root.relative_to(original_git_root).as_posix()
474+
relative_tests_root = original_test_cfg.tests_root.relative_to(original_git_root)
477475
new_tests_root = worktree_dir / relative_tests_root
478476
self.args.tests_root = new_tests_root
479477
self.test_cfg.tests_root = new_tests_root
480478

481479
# mutate tests project root
482-
relative_tests_project_root = original_args.test_project_root.relative_to(original_git_root).as_posix()
480+
relative_tests_project_root = original_args.test_project_root.relative_to(original_git_root)
483481
self.args.test_project_root = worktree_dir / relative_tests_project_root
484482
self.test_cfg.tests_project_rootdir = worktree_dir / relative_tests_project_root
485483

486484
# mutate benchmarks root
487485
relative_benchmarks_root = (
488-
original_args.benchmarks_root.relative_to(original_git_root).as_posix()
489-
if original_args.benchmarks_root
490-
else None
486+
original_args.benchmarks_root.relative_to(original_git_root) if original_args.benchmarks_root else None
491487
)
492488
if relative_benchmarks_root:
493489
self.args.benchmarks_root = worktree_dir / relative_benchmarks_root

0 commit comments

Comments
 (0)