Git
Index¶
- git::is_git_repo
- git::assert_git_repo
- git::repo_root
- git::canonical_name
- git::canonical_email
- git::write_distinct_identities
- git::print_identities
- git::prompt_select_identities
- git::count_author_matches
- git::count_committer_matches
- git::count_author_or_committer_matches
- git::resolve_filter_repo_cmd
git::is_git_repo¶
Return true if the given path is inside a git repository (work tree, bare repo, or .git dir).
Arguments¶
- $1 (dir): path
git::assert_git_repo¶
Die if the given path is not inside a git repository.
Arguments¶
- $1 (dir): path
Exit codes¶
- 0: if true
- 1: if false
git::repo_root¶
Resolve the toplevel (work-tree root) of the repo containing the given dir. Validates the path is a git repo first. Dies if not.
Arguments¶
- $1 (dir): path inside a git repo
Output on stdout¶
- absolute path of the repo's toplevel
git::canonical_name¶
Get the configured user.name for the given repo. Dies if unset or empty. Resolution follows the standard git config chain (local > global > system).
Arguments¶
- $1 (repo): path inside a git repo
Output on stdout¶
- the configured user.name
git::canonical_email¶
Get the configured user.email for the given repo. Dies if unset or empty. Resolution follows the standard git config chain (local > global > system).
Arguments¶
- $1 (repo): path inside a git repo
Output on stdout¶
- the configured user.email
git::write_distinct_identities¶
Write distinct identities (union of author and committer) from every commit reachable
via --all to out_file. One identity per line, tab-separated as: name
Arguments¶
- $1 (repo): path inside a git repo
- $2 (out_file): destination file (overwritten)
git::print_identities¶
Pretty-print identities from a tab-separated name
Arguments¶
- $1 (prefix_msg): log line printed before the bullets
- $2 (file): path to identities file (tab-separated name
email)
git::prompt_select_identities¶
Interactively prompt the user for each identity in distinct_file. Each accepted identity is appended (verbatim) to selected_file. selected_file is truncated on entry. distinct_file is read via FD 3 so the prompt's stdin is preserved. The prompt defaults to YES (prompt::yn) for identities whose name shares a whitespace-separated token with canonical_name (case-insensitive, alphanumeric-word match — so canonical 'Rick Venutolo' matches identities like 'Rick Venutolo' or 'Venutolo, Rick'); otherwise it defaults to NO (prompt::ny). An empty canonical_name disables smart defaulting (always default-no).
Arguments¶
- $1 (distinct_file): source file (tab-separated name
email rows) - $2 (selected_file): destination file for picked rows (overwritten then appended)
- $3 (canonical_name): name used to derive default-yes tokens (may be empty)
git::count_author_matches¶
Count commits across --all whose author identity (name
Arguments¶
- $1 (repo): path inside a git repo
- $2 (selected_file): tab-separated name
email file
Output on stdout¶
- match count (integer)
git::count_committer_matches¶
Count commits across --all whose committer identity (name
Arguments¶
- $1 (repo): path inside a git repo
- $2 (selected_file): tab-separated name
email file
Output on stdout¶
- match count (integer)
git::count_author_or_committer_matches¶
Count commits across --all whose author OR committer identity (name
Arguments¶
- $1 (repo): path inside a git repo
- $2 (selected_file): tab-separated name
email file
Output on stdout¶
- match count (integer)
git::resolve_filter_repo_cmd¶
Populate the named array with the command (and any leading args) to invoke
git-filter-repo. Prefers the local binary; falls back to running it via nix run from
nixpkgs-unstable. Dies if neither git-filter-repo nor nix is on PATH.
Arguments¶
- $1 (array_name): name of an existing array variable to populate (via nameref)