nicetoolbox.utils.git_utils¶
Helper functions for git integration of the code
Functions
Tries to get git commit metadata from the current repo or environment variables. |
Classes
Create new instance of GitMetadata(commit_hash, commit_summary) |
- class nicetoolbox.utils.git_utils.GitMetadata(commit_hash, commit_summary)[source]¶
Create new instance of GitMetadata(commit_hash, commit_summary)
- commit_hash: str¶
Alias for field number 0
- commit_summary: str¶
Alias for field number 1
- nicetoolbox.utils.git_utils.try_get_toolbox_git_metadata(repo_path: str = '.') GitMetadata | None[source]¶
Tries to get git commit metadata from the current repo or environment variables. If no .git folder is found or environment variables are not set, it will return None.
- Parameters:
repo_path (str) – Path to look for a .git folder (default: current folder).
- Raises:
git.exc.InvalidGitRepositoryError – If .git folder exists but is invalid
git.exc.GitCommandError – If git operations fail
- Returns:
with fields commit_hash and commit_summary, or None if neither is available.
- Return type:
Optional[GitMetadata]