Skip to content

Commit

Permalink
Fix IndexObject.abspath docstring formatting
Browse files Browse the repository at this point in the history
The original problem where the backslash wasn't included in the
docstring at all was fixed in 7dd2095 (gitpython-developers#1725), but the backslash
still did not appear in rendered Sphinx documentation, because it
was also treated as a reStructuredText metacharacter.

Although that can be addressed by adding a further backslash to
escape it, the effect is ambiguous when the docstring is read in
the code. So this just encloses it in a double-backticked code
span instead, which is a somewhat clearer way to show it anyway.
  • Loading branch information
EliahKagan committed Feb 27, 2024
1 parent 115451d commit 5219489
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git/objects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def abspath(self) -> PathLike:
Absolute path to this index object in the file system (as opposed to the
:attr:`path` field which is a path relative to the git repository).
The returned path will be native to the system and contains '\' on Windows.
The returned path will be native to the system and contains ``\`` on
Windows.
"""
if self.repo.working_tree_dir is not None:
return join_path_native(self.repo.working_tree_dir, self.path)
Expand Down

0 comments on commit 5219489

Please sign in to comment.