Skip to content

Commit

Permalink
Change: Allow to pass PathLike instances to Git.add method
Browse files Browse the repository at this point in the history
Extend the Git.add method to accept PathLike instances.
  • Loading branch information
bjoernricks committed Sep 1, 2022
1 parent d134e76 commit c455040
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pontos/git/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,18 @@ def list_tags(self) -> List[str]:
"""
return exec_git("tag", "-l", cwd=self._cwd).splitlines()

def add(self, files: Union[str, List[str]]):
def add(self, files: Union[PathLike, List[PathLike]]):
"""
Add files to the git staging area
Args:
files: A single file or a list of files to add to the staging area
"""
if isinstance(files, str):
if isinstance(files, (PathLike, str, bytes)):
files = [files]

args = ["add"]
args.extend(files)
args.extend([fspath(file) for file in files])

exec_git(*args, cwd=self._cwd)

Expand Down

0 comments on commit c455040

Please sign in to comment.