From 46740590f7918fd5b789c95db7e41fbda06fb46f Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 14 Sep 2024 16:52:56 +0500 Subject: [PATCH] Remove redundant path normalization for working_tree_dir --- git/index/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/index/base.py b/git/index/base.py index 7f53e614a..39cc9143c 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -653,7 +653,7 @@ def _to_relative_path(self, path: PathLike) -> PathLike: return path if self.repo.bare: raise InvalidGitRepositoryError("require non-bare repository") - if not osp.normpath(str(path)).startswith(osp.normpath(str(self.repo.working_tree_dir))): + if not osp.normpath(str(path)).startswith(str(self.repo.working_tree_dir)): raise ValueError("Absolute path %r is not in git repository at %r" % (path, self.repo.working_tree_dir)) return os.path.relpath(path, self.repo.working_tree_dir)