Skip to main content Module git Copy item path Source pub use worktree::Worktree ;worktree git worktree wrapper for hermetic per-run workspaces.Commit GitInfo SemVer SHORT_COMMIT_LEN Default short-commit length used across error messages, log
output, and any place that needs to truncate a full SHA for
human display. Matches git’s --short default (7) — and the
ShortCommit template var populated by super::detect_git_info
(which delegates to git rev-parse --short). add_path_in git -C <workspace_root> add <rel> — stage a single relative path.check_git_available Check whether git is available in PATH. commit_in git -C <workspace_root> commit [-S] -m <message> — create a commit
with the given message, optionally GPG-signed.create_and_push_tag Create an annotated tag and push it if an origin remote exists. create_and_push_tag_in Create an annotated tag in cwd and push it if an origin remote exists. create_tag_via_github_api Create a tag via the GitHub API (using the gh CLI). create_tag_via_github_api_in Path-taking sibling of create_tag_via_github_api . detect_git_info Detect git info for a given tag. detect_git_info_in Detect git info for a given tag against a repository at cwd. detect_github_repo Get the GitHub owner/name from the origin remote. detect_github_repo_in Get the GitHub owner/name from the origin remote configured in cwd. detect_owner_repo Get the owner/repo from the origin remote, regardless of SCM host. detect_owner_repo_in Get the owner/repo from the origin remote configured in cwd,
regardless of SCM host. extract_tag_prefix Extract the prefix portion of a tag template by locating the version placeholder. find_latest_tag_matching Find the latest tag matching a template pattern.
E.g., tag_template “cfgd-core-v{{ .Version }}” → matches tags like “cfgd-core-v1.2.3” find_latest_tag_matching_in Path-taking sibling of find_latest_tag_matching . find_latest_tag_matching_with_prefix Like find_latest_tag_matching , but with optional monorepo prefix filtering. find_latest_tag_matching_with_prefix_in Path-taking sibling of find_latest_tag_matching_with_prefix . find_previous_tag Find the tag immediately before current_tag in commit history. find_previous_tag_in Path-taking sibling of find_previous_tag . find_previous_tag_with_prefix Like find_previous_tag , but with optional monorepo prefix filtering. find_previous_tag_with_prefix_in Path-taking sibling of find_previous_tag_with_prefix . get_all_commits Get all commits reachable from HEAD, optionally filtered to a path.
Used for initial releases where there is no previous tag. get_all_commits_in Path-taking sibling of get_all_commits . get_all_commits_paths Get all commits reachable from HEAD, filtered to multiple paths. get_all_commits_paths_in Path-taking sibling of get_all_commits_paths . get_all_semver_tags Get all semver tags in the repo, sorted descending by version.
Prerelease tags sort after release tags of the same major.minor.patch. get_all_semver_tags_in Path-taking sibling of get_all_semver_tags . get_branch_semver_tags Get semver tags reachable from HEAD, sorted descending by version.
Prerelease tags sort after release tags of the same major.minor.patch. get_branch_semver_tags_in Path-taking sibling of get_branch_semver_tags . get_commit_messages_between Get commit subjects between two refs. get_commit_messages_between_in Path-taking sibling of get_commit_messages_between . get_commit_messages_between_path Get commit subjects between two refs that touched a specific path. get_commit_messages_between_path_in Path-taking sibling of get_commit_messages_between_path . get_commits_between Get commits between two refs, optionally filtered to a path. get_commits_between_in Path-taking sibling of get_commits_between . get_commits_between_paths Get commits between two refs, filtered to multiple paths (git log – path1 path2 …). get_commits_between_paths_in Path-taking sibling of get_commits_between_paths . get_current_branch Get the current branch name. get_current_branch_in Path-taking sibling of get_current_branch . get_first_commit Return the SHA of the very first commit in the repository. get_first_commit_in Path-taking sibling of get_first_commit . get_head_commit Get the full commit hash of HEAD. get_head_commit_in Path-taking sibling of get_head_commit . get_last_commit_messages Get last N commit subjects. get_last_commit_messages_in Path-taking sibling of get_last_commit_messages . get_last_commit_messages_path Get last N commit subjects that touched a specific path. get_last_commit_messages_path_in Path-taking sibling of get_last_commit_messages_path . get_short_commit Get the short commit hash of HEAD. get_short_commit_in Path-taking sibling of get_short_commit . gh_api_get GET a GitHub API endpoint via the gh CLI (single request, no pagination). gh_api_get_paginated GET a GitHub API endpoint via the gh CLI, with pagination. gh_api_get_paginated_with_binary Paginated GET via gh_binary. Path-taking sibling of
gh_api_get_paginated . gh_api_get_with_binary GET a GitHub API endpoint via gh_binary (single request, no pagination). git_status_porcelain Return the git status --porcelain output showing dirty files. git_status_porcelain_in Return the git status --porcelain output from a repository at cwd. has_changes_since Check if there are changes in a path since a given tag. has_changes_since_in Path-taking sibling of has_changes_since . has_commits_since_tag Check if there are any commits since a given tag. has_commits_since_tag_in Path-taking sibling of has_commits_since_tag . has_version_placeholder Check whether a tag template string contains any recognised version placeholder. head_commit_hash_in git -C <repo> rev-parse HEAD — return HEAD’s full commit hash for the
given repository (or worktree). Path-taking sibling of
get_head_commit so callers (the determinism harness, future CI
glue) can resolve HEAD without cd-ing into the repo first.head_commit_timestamp_in git -C <repo> log -1 --format=%ct HEAD — return HEAD’s committer
timestamp (seconds since UNIX epoch) for the given repository. Used by
the determinism harness as the non-snapshot SDE seed.head_is_at_tag Returns true when HEAD coincides with a tag. is_git_dirty Check whether the working tree has uncommitted changes. is_git_dirty_in Check whether the working tree in cwd has uncommitted changes. is_git_repo Check whether the current directory is inside a git repository. is_git_repo_in Check whether cwd is inside a git repository. is_shallow_clone Check whether the current repository is a shallow clone. is_shallow_clone_in Check whether the repository at cwd is a shallow clone. list_tags_with_prefix git -C <workspace_root> tag --list --sort=-v:refname '<prefix>*' —
return the list of refs whose name starts with prefix, ordered by
reverse semver. Returns Ok(Vec::new()) when git fails (no repo,
no tags) so callers can treat absence as a non-error.local_git_user_email Read git config user.email, or None if unset / git is unavailable. local_git_user_email_in Read git config user.email from a repository at cwd. local_git_user_name Read git config user.name, or None if unset / git is unavailable. local_git_user_name_in Read git config user.name from a repository at cwd. log_subjects_for_range git -C <workspace_root> -c log.showSignature=false log --pretty=format:%B%x1e <range> -- <rel_path> — list commit message
bodies (subject+body) for commits in range touching rel_path,
using the \x1e (RS) byte as a between-commits separator so multi-line
bodies survive parsing.parse_github_remote Parse owner and repo name from a GitHub remote URL.
Supports HTTPS (https://github.com/owner/repo.git) and SSH (git@github.com:owner/repo.git). parse_remote_owner_repo Parse owner and repo from any git remote URL, regardless of host. parse_semver Parse a strict semver version from a string like “v1.2.3”, “1.2.3”, “v1.0.0-rc.1”,
“v1.0.0+build.42”, or “v1.0.0-rc.1+build.42”. parse_semver_tag Parse a semver version from a prefixed tag string. paths_changed_since_tag git diff --name-only <tag>..HEAD -- <paths>... — return true when
any of the named paths changed between tag and HEAD. Returns
Ok(false) when git fails (e.g. not a git repo) so callers can treat
the absence-of-info case as “no changes”.paths_changed_since_tag_in Path-taking sibling of paths_changed_since_tag . render_ignore_patterns Render ignore patterns (both ignore_tags and ignore_tag_prefixes) through
the template engine when template_vars is provided. resolve_snapshot_sde Resolves the SOURCE_DATE_EPOCH for a snapshot-mode release run. short_commit_str Truncate a full commit SHA string to SHORT_COMMIT_LEN
characters. Returns the input unchanged when it’s already shorter
or equal in length. Use this any time the SHA arrives as a string
(e.g. deserialized from a manifest or read from a template var)
rather than running git rev-parse --short again — saves a
subprocess and keeps the length convention in one place. stage_and_commit Stage specific files and create a commit. stage_and_commit_in Path-taking sibling of stage_and_commit . strip_monorepo_prefix Strip a monorepo tag prefix from a tag string. tag_points_at_head Check whether tag points at the current HEAD commit. tag_points_at_head_in Path-taking sibling of tag_points_at_head .