Skip to content

Commit

Permalink
Change: Introduce stage_files API and deprecate stage_files_from_stat…
Browse files Browse the repository at this point in the history
…us_list

With StatusEntry being a PathLike object a new function stage_files can
be used to add generic file objects to the git staging index. Therefore
stage_files_from_status_list has become obsolete and currently just
forwards to stage_files.
  • Loading branch information
bjoernricks committed May 16, 2022
1 parent f530332 commit 095b1a4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions autohooks/api/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,23 @@ def get_staged_status(


def stage_files_from_status_list(status_list: Iterable[StatusEntry]) -> None:
"""Add the passed files to staged
"""Add the passed files from the status list to git staging index
Deprecated. Please use stage_files instead.
Arguments:
status_list: A List of StatusEntries that should be added
"""
filenames = [str(s.path) for s in status_list]
stage_files(status_list)


def stage_files(files: Iterable[PathLike]) -> None:
"""Add the passed files to git staging index
Arguments:
files: A List of files to add to the index
"""
filenames = [os.fspath(f) for f in files]
exec_git("add", *filenames)


Expand Down

0 comments on commit 095b1a4

Please sign in to comment.