Skip to main content

Crate gitwig_core

Crate gitwig_core 

Source
Expand description

Filesystem + git repository inspection.

This module owns both the “is this a git repo?” classification used by the per-card indicator AND the richer detail collection used by the Detail view. They share a single collect_summary helper so the same libgit2 work doesn’t run twice.

The cheap is_dir() + .git-existence check still gates everything — we only spin up libgit2 when both checks pass.

Structs§

BranchInfo
CommitEntry
CommitterStat
DiffLine
One line of a unified diff, as rendered in the Diff panel.
FileEntry
One changed file in the working tree or index.
FileRevision
GraphCommit
GraphLine
HeadInfo
RemoteInfo
RepoInfo
RepoSummary
Compact summary used to draw the per-card indicator. Also embedded in RepoInfo so the Detail view doesn’t re-collect the same data.
StashInfo
WorktreeChanges
File-level working-tree state collected for the Detail view. Split into four buckets so the UI can render them as separate sections.

Enums§

DiffLineKind
The type of a single line in a unified diff.
ItemDetail
ItemStatus
Per-item filesystem classification carried alongside config.items. GitRepo’s inner Option is None when .git exists but libgit2 couldn’t open or read the repo — we know it’s a repo, we just can’t summarize its state.
TabData
TabPayload

Functions§

abort_merge
Abort the in-progress merge.
apply_stash
checkout_local_branch
checkout_remote_branch
checkout_tag
commit_amend
commit_changes
Create a commit in the repository with the given message. Returns a human-readable error string on failure.
continue_merge
Continue the merge after conflicts are resolved.
create_branch
Creates a new local branch pointing at HEAD.
create_tag
Creates a new lightweight tag pointing at the specified commit OID.
delete_local_branch
Deletes a local branch.
delete_remote_branch
Deletes a remote-tracking branch locally.
delete_remote_tag
Deletes a tag on the remote.
delete_stash
delete_tag
Deletes a local tag.
deserialize_tags
discard_all_changes
Discard all staged, unstaged, and untracked changes in the repository.
discard_file_changes
Discards uncommitted changes in file_path.
discard_hunk
Discard a single hunk of unstaged changes in the working tree (equivalent to git apply --reverse -).
discard_line
Discard a single line from the Unstaged diff in the working tree.
expand_tilde
Expand a leading ~ or ~/ in a user-supplied path to the user’s home directory. Returns the input unchanged if there is no home dir or no tilde to expand.
get_branch_push_target
Finds the remote target for pushing a branch. Returns (remote_name, set_upstream).
get_branch_upstream_remote
Returns the upstream tracking remote name for a branch, if configured.
get_commit_file_diff
Return the unified diff of file_path as it changed in commit_oid (hex string) inside the repository at repo_path. Returns an empty Vec on any error.
get_commit_files
get_conflict_markers_diff
Returns the conflict-marker diff for a conflicted file by parsing the file on disk. Colorizes conflict blocks using DiffLineKind variants.
get_file_history
get_last_commit_message
get_latest_change_time
get_remote_tags
Helper to run git ls-remote --tags and return parsed tag information.
get_worktree_file_diff
Return the diff for file_path in the working tree.
has_upstream_remote
Returns whether the specified branch has a configured upstream tracking branch.
inspect_detail
Inspect item and produce the rich detail report shown on Enter.
inspect_summary
Classify item and produce a card-level summary. Used by the list view.
invalidate_ref_map_cache
is_merging
Returns true when .git/MERGE_HEAD exists — i.e. a merge is in progress. Cheap file-existence check, no libgit2 required.
is_root_commit
Returns whether the specified commit OID has no parents (i.e. it is the root commit).
load_tab_branches
load_tab_files
load_tab_graph_stream
load_tab_overview
load_tab_remotes
load_tab_stashes
load_tab_tags
mark_resolved
Mark the file as resolved (stage it) after manual edits.
remote_add
Add a new git remote.
remote_delete
Delete an existing git remote.
resolve_conflict_hunk
Resolve a specific conflict hunk inside a file (Ours vs Theirs). Replaces the hunk at index hunk_idx in the file on disk. If no more conflicts remain in the file, it automatically stages the file.
resolve_ours
Accept the OURS (HEAD) version of a conflicted file. Equivalent to: git checkout –ours && git add
resolve_theirs
Accept the THEIRS (incoming) version of a conflicted file. Equivalent to: git checkout –theirs && git add
save_stash
serialize_tags
stage_all_changes
Stage all unstaged/untracked changes (equivalent to git add -A).
stage_file
Add file_path to the index (equivalent to git add <file>). Returns a human-readable error string on failure.
stage_hunk
Stage a single hunk of unstaged changes (equivalent to git apply --cached -).
stage_line
Stage a single line from the Unstaged diff.
unstage_all_changes
Unstage all staged changes (equivalent to git reset).
unstage_file
Remove file_path from the index (equivalent to git restore --staged <file>). When HEAD exists the index entry is reset to the HEAD tree value; for a brand-new repo with no commits the entry is simply removed from the index. Returns a human-readable error string on failure.
unstage_hunk
Unstage a single hunk of staged changes (equivalent to git apply --cached --reverse -).
unstage_line
Unstage a single line from the Staged diff.