API Reference#
- class giterator.Git(path: Path | str)#
Represents a local work tree and repo.
- Parameters:
path – The path to an existing work tree or local repo.
- __call__(*command, env: dict | None = None, cwd: Path | None = None) str #
Run a git command in this repo. For example:
Git(...)('log', '-1')
- git(*command, env: dict | None = None, cwd: Path | None = None) str #
Run a git command in this repo. For example:
Git(...)('log', '-1')
- init(user: User | None = None) None #
Create an empty Git repository or reinitialize an existing one. If the path doesn’t exist, it will be created. This includes any missing parent directories.
- Parameters:
user – The user to configure in the local repo.
- commit(msg: str, author_date: date | datetime | str | None = None, commit_date: date | datetime | str | None = None) str #
Commit changes in this repo, including and new or deleted files.
- Parameters:
msg – The commit message.
author_date – The author date.
commit_date – The commit date. Defaults to author date if not specified.
- class giterator.testing.Repo(path: Path | str)#
A repo for use in automated tests.
- classmethod make(path: Path | str, user: User | None = None)#
Make a repo at the path specified and ensure a user is configured in the repo. The user can be specified.
- commit(msg: str, author_date: date | datetime | str | None = None, commit_date: date | datetime | str | None = None) str #
Commit changes in this repo, including and new or deleted files.
- Parameters:
msg – The commit message.
author_date – The author date.
commit_date – The commit date. Defaults to author date if not specified.