GitOps.Git (Git Ops v2.12.1)
View SourceHelper functions for working with Git and fetching the tags/commits we care about.
Summary
Functions
The blob OID contents would hash to.
The subject line of a commit.
Commits files (a map of repo-relative path to contents) on top of
base_ref using a temporary index, leaving the working tree untouched.
Returns the new commit's SHA.
First-parent commit SHAs of HEAD that touch path, newest first.
The name of the currently checked out branch.
Commit info since a tag (or all commits), newest first.
The blob OID at ref:path, or nil when absent. Resolved from tree
objects alone, so it never fetches blobs on a partial clone.
Force-pushes a commit or tag ref to origin.
The tree hash of the origin remote's branch, or nil when the branch
does not exist there.
The tag names present on the origin remote, or the local tags when there
is no reachable remote.
The contents of path at ref, or :error if it does not exist there.
All tags starting with prefix, newest version first.
Types
Functions
@spec add!(Git.Repository.t(), [String.t()]) :: String.t()
@spec blob_oid(Git.Repository.t(), String.t()) :: String.t()
The blob OID contents would hash to.
@spec commit!(Git.Repository.t(), [String.t()]) :: String.t()
@spec commit_subject!(Git.Repository.t(), String.t()) :: String.t()
The subject line of a commit.
@spec commit_tree!( Git.Repository.t(), String.t(), %{required(String.t()) => String.t()}, String.t() ) :: String.t()
Commits files (a map of repo-relative path to contents) on top of
base_ref using a temporary index, leaving the working tree untouched.
Returns the new commit's SHA.
@spec commits_touching!(Git.Repository.t(), String.t(), pos_integer()) :: [String.t()]
First-parent commit SHAs of HEAD that touch path, newest first.
@spec current_branch!(Git.Repository.t()) :: String.t()
The name of the currently checked out branch.
@spec get_commit_info(Git.Repository.t(), String.t() | :all, Keyword.t()) :: [ commit_info() ]
Commit info since a tag (or all commits), newest first.
Options:
:paths- pathspecs restricting which commits count (git pathspec syntax, so:^direntries exclude).:first_parent- follow only the first parent of merge commits.
@spec hooks_path(Git.Repository.t()) :: String.t() | no_return()
@spec init!(String.t()) :: Git.Repository.t()
@spec oid_at(Git.Repository.t(), String.t(), String.t()) :: String.t() | nil
The blob OID at ref:path, or nil when absent. Resolved from tree
objects alone, so it never fetches blobs on a partial clone.
@spec parse_git_log(String.t()) :: [commit_info()]
@spec push!(Git.Repository.t(), String.t(), String.t()) :: :ok
Force-pushes a commit or tag ref to origin.
@spec remote_branch_tree(Git.Repository.t(), String.t()) :: String.t() | nil
The tree hash of the origin remote's branch, or nil when the branch
does not exist there.
@spec remote_tags(Git.Repository.t()) :: MapSet.t(String.t())
The tag names present on the origin remote, or the local tags when there
is no reachable remote.
@spec show(Git.Repository.t(), String.t(), String.t()) :: {:ok, String.t()} | :error
The contents of path at ref, or :error if it does not exist there.
@spec tag!(Git.Repository.t(), String.t() | [String.t()]) :: String.t()
@spec tag_exists?(Git.Repository.t(), String.t()) :: boolean()
@spec tags(Git.Repository.t()) :: [String.t()]
@spec tags(Git.Repository.t(), String.t()) :: [String.t()]
All tags starting with prefix, newest version first.
Unlike tags/1, returns an empty list when nothing matches, so callers can
treat "never released" as a normal state.