Skip to main content

Crate ag_git

Crate ag_git 

Source
Expand description

Reusable git, worktree, sync, rebase, and squash-merge orchestration.

Structs§

RealGitClient
Production GitClient implementation backed by real git commands.

Enums§

GitError
Re-exported typed error for git infrastructure operations. Typed error returned by git infrastructure operations.
PullRebaseResult
Re-exported commit/sync/diff APIs. Result of attempting git pull --rebase.
RebaseStepResult
Re-exported rebase/conflict APIs. Result of attempting a rebase step.
SingleCommitMessageStrategy
Re-exported commit/sync/diff APIs. Controls how single-commit session branches treat the commit message when amending HEAD.
SquashMergeOutcome
Re-exported squash-merge APIs. Outcome of attempting a squash merge operation.

Traits§

GitClient
Low-level async git boundary used by app orchestration code.

Functions§

abort_rebase
Re-exported rebase/conflict APIs. Aborts an in-progress rebase.
branch_tracking_statuses
Re-exported commit/sync/diff APIs. Returns ahead/behind snapshots for every local branch in repo_path.
commit_all
Re-exported commit/sync/diff APIs. Stages all changes and commits them with the given message.
commit_all_preserving_single_commit
Re-exported commit/sync/diff APIs. Stages all changes and keeps a single commit for the provided message.
create_worktree
Re-exported worktree and branch-detection APIs. Creates a git worktree at the specified path with a new branch.
current_upstream_reference
Re-exported commit/sync/diff APIs. Returns the current upstream reference for HEAD.
delete_branch
Re-exported commit/sync/diff APIs. Deletes a git branch.
detect_git_info
Re-exported worktree and branch-detection APIs. Detects git repository information for the given directory. Returns the current branch name if in a git repository, None otherwise.
diff
Re-exported commit/sync/diff APIs. Returns the output of git diff for the given repository path, showing all changes (committed and uncommitted) relative to the base branch.
fetch_remote
Re-exported commit/sync/diff APIs. Fetches from the configured remote.
find_git_repo_root
Re-exported worktree and branch-detection APIs. Walks up the directory tree to find a .git directory. Returns the directory containing .git (the repository root) if found, None otherwise.
get_ahead_behind
Re-exported commit/sync/diff APIs. Returns the number of commits ahead and behind the upstream branch.
get_ref_ahead_behind
Re-exported commit/sync/diff APIs. Returns the number of commits left_ref is ahead of and behind right_ref.
has_commits_since
Re-exported commit/sync/diff APIs. Returns whether HEAD contains commits that are not reachable from base_branch.
has_unmerged_paths
Re-exported rebase/conflict APIs. Returns whether unresolved paths still exist in the index.
head_commit_message
Re-exported commit/sync/diff APIs. Returns the full HEAD commit message, or None when no commits exist.
head_hash
Re-exported commit/sync/diff APIs. Returns the full hash of the current HEAD commit.
head_short_hash
Re-exported commit/sync/diff APIs. Returns the short hash of the current HEAD commit.
is_rebase_in_progress
Re-exported rebase/conflict APIs. Returns whether a rebase is currently in progress in the repository or worktree.
is_worktree_clean
Re-exported commit/sync/diff APIs. Returns whether a repository or worktree has no uncommitted changes.
list_conflicted_files
Re-exported rebase/conflict APIs. Returns conflicted file paths for the current index.
list_local_commit_titles
Re-exported commit/sync/diff APIs. Returns local commit subjects that are not yet present in upstream.
list_staged_conflict_marker_files
Re-exported rebase/conflict APIs. Returns which of the given paths still contain git conflict markers (<<<<<<<) in their staged content.
list_upstream_commit_titles
Re-exported commit/sync/diff APIs. Returns upstream commit subjects that are not yet in local HEAD.
main_repo_root
Re-exported repository metadata APIs. Resolves the main repository root for a repository or linked worktree.
pull_rebase
Re-exported commit/sync/diff APIs. Runs git pull --rebase and returns conflict outcome when applicable.
push_current_branch
Re-exported commit/sync/diff APIs. Pushes the current branch to its upstream remote with --force-with-lease.
push_current_branch_to_remote_branch
Re-exported commit/sync/diff APIs. Pushes the current branch to one explicit remote branch name with --force-with-lease and returns the resulting upstream reference.
rebase
Re-exported rebase/conflict APIs. Rebases the current branch onto target_branch.
rebase_continue
Re-exported rebase/conflict APIs. Continues an in-progress rebase.
rebase_onto_start
Re-exported rebase/conflict APIs. Starts a rebase that moves commits after old_base onto new_base.
rebase_start
Re-exported rebase/conflict APIs. Rebases the current branch onto target_branch.
ref_hash
Re-exported commit/sync/diff APIs. Returns the full commit hash for a git reference.
remote_branch_exists
Re-exported commit/sync/diff APIs. Checks whether a branch already exists on the remote.
remove_worktree
Re-exported worktree and branch-detection APIs. Removes a git worktree at the specified path.
repo_url
Re-exported repository metadata APIs. Returns the origin repository URL normalized to HTTPS form when possible.
squash_merge
Re-exported squash-merge APIs. Performs a squash merge from a source branch to a target branch.
squash_merge_diff
Re-exported squash-merge APIs. Returns the full patch diff that will be squashed when merging a source branch into a target branch.
stage_all
Re-exported commit/sync/diff APIs. Stages all changes in the repository or worktree.
tracked_worktree_status
Re-exported commit/sync/diff APIs. Returns a stable porcelain status snapshot for tracked worktree files only.
worktree_status
Re-exported commit/sync/diff APIs. Returns a stable porcelain status snapshot for a repository or worktree.

Type Aliases§

BranchTrackingMap
Re-exported commit/sync/diff APIs. Map of local branch names to their ahead/behind counts relative to their tracked upstream branch. None indicates no upstream or a gone upstream.
GitFuture
Boxed async result used by GitClient trait methods.