diff --git a/README.md b/README.md index 412d38205..24c75f2c2 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ or low-level like git-plumbing. It provides abstractions of git objects for easy access of repository data often backed by calling the `git` command-line program. +For file discovery convenience, repositories expose both `Repo.untracked_files` and `Repo.tracked_files`. + ### DEVELOPMENT STATUS This project is in **maintenance mode**, which means that diff --git a/git/repo/base.py b/git/repo/base.py index 16807b9fa..6d6f42b62 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -170,6 +170,11 @@ class Repo: """Subclasses may easily bring in their own custom types by placing a constructor or type here.""" + @property + def tracked_files(self) -> List[str]: + """Files currently tracked by git.""" + return self.git.ls_files().splitlines() + def __init__( self, path: Optional[PathLike] = None,