Skip to main content

Crate codex_git_utils

Crate codex_git_utils 

Source

Structs§

ApplyGitRequest
Parameters for invoking apply_git_patch.
ApplyGitResult
Result of running apply_git_patch, including paths gleaned from stdout/stderr.
CommitLogEntry
A minimal commit summary entry used for pickers (subject + timestamp + sha).
GitBaselineChange
One changed file between a git baseline and the current directory.
GitBaselineDiff
Structured diff from the latest git baseline reset to the current directory.
GitDiffToRemote
GitInfo
GitSha

Enums§

FsmonitorOverride
The safe core.fsmonitor override for an internal Git command.
GitBaselineChangeStatus
File-level change status between a git baseline and the current directory.
GitToolingError
Errors returned while managing git worktree snapshots.

Traits§

FsmonitorProbeRunner
Executes the Git commands required by detect_fsmonitor_override.

Functions§

apply_git_patch
Apply a unified diff to the target repository by shelling out to git apply.
canonicalize_git_remote_url
collect_git_info
Collect git repository information from the given working directory using command-line git. Returns None if no git repository is found or if git operations fail. Uses timeouts to prevent freezing on large repositories. All git commands (except the initial repo check) run in parallel for better performance.
create_symlink
current_branch_name
Returns the current checked out branch name.
default_branch_name
Determine the repository’s default branch name, if available.
detect_fsmonitor_override
Returns the safe filesystem monitor override for the target repository.
diff_since_latest_init
Returns the diff between the latest baseline reset and the current directory contents.
ensure_git_baseline_repository
Ensures root has a usable git baseline repository.
extract_paths_from_patch
Collect every path referenced by the diff headers inside diff --git sections.
get_git_remote_urls
Collect fetch remotes in a multi-root-friendly format: {“origin”: “https://…”}.
get_git_remote_urls_assume_git_repo
Collect fetch remotes without checking whether cwd is in a git repo.
get_git_repo_root
Return true if the project folder specified by the Config is inside a Git repository.
get_git_repo_root_with_fs
Return the repository root for cwd using the provided filesystem.
get_has_changes
get_head_commit_hash
Return the current HEAD commit hash without checking whether cwd is in a git repo.
git_diff_to_remote
Returns the closest git sha to HEAD that is on a remote as well as the diff to that sha.
local_git_branches
Returns a list of local git branches. Includes the default branch at the beginning of the list, if it exists.
merge_base_with_head
Returns the merge-base commit between HEAD and the latest version between local and remote of the provided branch, if both exist.
parse_git_apply_output
Parse git apply output into applied/skipped/conflicted path groupings.
recent_commits
Return the last limit commits reachable from HEAD for the current branch. Each entry contains the SHA, commit timestamp (seconds), and subject line. Returns an empty vector if not in a git repo or on error/timeout.
reset_git_repository
Replaces any existing .git metadata in root with a fresh one-commit baseline.
resolve_root_git_project_for_trust
Resolve the path that should be used for trust checks. Similar to [get_git_repo_root], but resolves to the root of the main repository. Handles worktrees via filesystem inspection without invoking the git executable.
stage_paths
Stage only the files that actually exist on disk for the given diff.