diff --git a/codeflash/discovery/functions_to_optimize.py b/codeflash/discovery/functions_to_optimize.py index 48a453479..fed48199b 100644 --- a/codeflash/discovery/functions_to_optimize.py +++ b/codeflash/discovery/functions_to_optimize.py @@ -405,7 +405,10 @@ def is_git_repo(file_path: str) -> bool: def ignored_submodule_paths(module_root: str) -> list[str]: if is_git_repo(module_root): git_repo = git.Repo(module_root, search_parent_directories=True) - return [Path(git_repo.working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules] + try: + return [Path(git_repo.working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules] + except Exception as e: + logger.warning(f"Error getting submodule paths: {e}") return [] diff --git a/codeflash/tracing/tracing_utils.py b/codeflash/tracing/tracing_utils.py index 0114ea01c..ac8b3c888 100644 --- a/codeflash/tracing/tracing_utils.py +++ b/codeflash/tracing/tracing_utils.py @@ -38,7 +38,10 @@ def ignored_submodule_paths(module_root: str) -> list[Path]: if is_git_repo(module_root): git_repo = git.Repo(module_root, search_parent_directories=True) working_tree_dir = cast("Path", git_repo.working_tree_dir) - return [Path(working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules] + try: + return [Path(working_tree_dir, submodule.path).resolve() for submodule in git_repo.submodules] + except Exception as e: + print(f"Failed to get submodule paths {e!s}") # no logger since used in the tracer return []