Skip to content

Commit

Permalink
Remove redundant path normalization for working_tree_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej730 committed Sep 14, 2024
1 parent ca06b11 commit 4674059
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 4674059

Please sign in to comment.