bc_gitops_git (bc_gitops v0.7.0)
View SourceGit operations for bc_gitops.
This module wraps git commands for cloning, pulling, and querying repository state. It uses the system git command for maximum compatibility.
Git authentication is handled through standard git mechanisms: SSH keys, credential helpers, or inline URL credentials. For CI/CD environments, SSH deploy keys are recommended.
Summary
Functions
Checkout a specific ref (branch, tag, or commit).
Clone a repository to the local path.
Ensure the repository exists locally, cloning if necessary.
Get the commit log for the last N commits.
Get the current HEAD commit SHA.
Check if a path is a git repository.
Pull the latest changes from the remote repository.
Functions
Checkout a specific ref (branch, tag, or commit).
Clone a repository to the local path.
Ensure the repository exists locally, cloning if necessary.
If the local path exists and is a git repository, this does nothing. Otherwise, it clones the repository.
-spec get_commit_log(binary(), pos_integer()) -> {ok, [map()]} | {error, term()}.
Get the commit log for the last N commits.
Returns a list of maps with commit info.
Get the current HEAD commit SHA.
-spec is_repo(file:filename()) -> boolean().
Check if a path is a git repository.
Pull the latest changes from the remote repository.
Returns the commit SHA after pulling.