Skip to content

Commit 0e8f5e4

Browse files
authored
Merge pull request #914 from codeflash-ai/catch-submodule-bugs
submodule bugs
2 parents b17c5bf + 036d6f6 commit 0e8f5e4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

codeflash/discovery/functions_to_optimize.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,10 @@ def is_git_repo(file_path: str) -> bool:
405405
def ignored_submodule_paths(module_root: str) -> list[str]:
406406
if is_git_repo(module_root):
407407
git_repo = git.Repo(module_root, search_parent_directories=True)
408-
return [Path(git_repo.working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules]
408+
try:
409+
return [Path(git_repo.working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules]
410+
except Exception as e:
411+
logger.warning(f"Error getting submodule paths: {e}")
409412
return []
410413

411414

codeflash/tracing/tracing_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def ignored_submodule_paths(module_root: str) -> list[Path]:
3838
if is_git_repo(module_root):
3939
git_repo = git.Repo(module_root, search_parent_directories=True)
4040
working_tree_dir = cast("Path", git_repo.working_tree_dir)
41-
return [Path(working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules]
41+
try:
42+
return [Path(working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules]
43+
except Exception as e:
44+
print(f"Failed to get submodule paths {e!s}") # no logger since used in the tracer
4245
return []
4346

4447

0 commit comments

Comments
 (0)