Expand description
§use-git
use-git is a RustUse facade crate for primitive Git vocabulary: object identifiers, refs, branches, tags, remotes, refspecs, revision selectors, pathspecs, ignore patterns, attributes, and status metadata.
It is not a Git client, repository engine, command runner, or storage implementation. It provides small, composable types that other crates can use when they need to talk about Git concepts without taking on a full Git dependency.
§What this crate provides
| Feature | Namespace | Focused crate | Purpose |
|---|---|---|---|
oid | use_git::oid | use-git-oid | Object identifier and short object identifier primitives |
refs | use_git::refs | use-git-ref | Ref names, ref kinds, symbolic refs, and HEAD vocabulary |
branch | use_git::branch | use-git-branch | Local, remote-tracking, and default branch name primitives |
tag | use_git::tag | use-git-tag | Tag names, tag kind vocabulary, and version-like tag wrappers |
remote | use_git::remote | use-git-remote | Remote names, remote refs, and remote-tracking ref primitives |
refspec | use_git::refspec | use-git-refspec | Fetch and push refspec syntax primitives |
revision | use_git::revision | use-git-revision | Revision selectors, suffixes, and range vocabulary |
pathspec | use_git::pathspec | use-git-pathspec | Pathspec patterns, magic labels, and scope vocabulary |
ignore | use_git::ignore | use-git-ignore | Gitignore-style pattern and line classification vocabulary |
attribute | use_git::attribute | use-git-attribute | Gitattributes pattern and attribute state vocabulary |
status | use_git::status | use-git-status | Index, worktree, conflict, file-change, and porcelain status metadata |
§Installation
[dependencies]
use-git = "0.0.1"Disable default features when you want a narrow facade surface:
[dependencies]
use-git = { version = "0.0.1", default-features = false, features = ["oid", "refs"] }§Basic usage
#[cfg(all(feature = "oid", feature = "branch", feature = "refs"))]
{
use use_git::{GitBranchName, GitOid, GitRefName};
let oid: GitOid = "0123456789abcdef0123456789abcdef01234567"
.parse()
.expect("valid oid");
let branch = GitBranchName::new("feature/use-git").expect("valid branch");
let reference = GitRefName::new("refs/heads/main").expect("valid ref");
assert_eq!(oid.kind(), use_git::GitOidKind::Sha1);
assert!(branch.is_feature());
assert!(reference.is_branch());
}§Scope
The facade only composes the focused vocabulary crates. It does not resolve, inspect, fetch, update, store, or compare repository data.
§Non-goals
- No
Gitcommand execution. - No repository storage or object database access.
- No clone, fetch, pull, push, merge, rebase, checkout, or commit behavior.
- No packfile parsing.
- No history walking or diff computation.
- No dependency on
git2,gix,gitoxide, or libgit2 bindings. Thin facade for primitiveGitvocabulary crates.
Re-exports§
pub use use_git_attribute as attribute;pub use use_git_branch as branch;pub use use_git_ignore as ignore;pub use use_git_oid as oid;pub use use_git_pathspec as pathspec;pub use use_git_ref as refs;pub use use_git_refspec as refspec;pub use use_git_remote as remote;pub use use_git_revision as revision;pub use use_git_status as status;pub use use_git_tag as tag;
Structs§
- Default
Branch Name - A conventional default branch name.
- GitAttribute
Name - A validated attribute name.
- GitAttribute
Rule - A
gitattributes-style rule model. - GitAttribute
Value - A plain attribute value.
- GitBranch
Name - A validated branch name.
- GitIgnore
Pattern - A non-empty ignore pattern.
- GitIgnore
Rule - A classified ignore rule.
- GitOid
- A full
Gitobject identifier. - GitPathspec
- A lightweight pathspec wrapper.
- GitRef
- A concrete ref wrapper.
- GitRef
Name - A validated ref name.
- GitRefspec
- A lightweight refspec model.
- GitRemote
Name - A validated remote name.
- GitRevision
- A lightweight revision selector text.
- GitStatus
- Combined status metadata.
- GitTag
Name - A validated tag name.
- Local
Branch Name - A local branch name.
- Pathspec
Pattern - A pathspec pattern string.
- Refspec
Destination - Refspec destination text.
- Refspec
Source - Refspec source text.
- Remote
RefName - A remote ref name.
- Remote
Tracking Branch Name - A remote-tracking branch spelling such as
origin/main. - Remote
Tracking Ref - A remote-tracking ref spelling such as
origin/main. - Revision
Range - A revision range such as
A..BorA...B. - Short
GitOid - A short object identifier prefix.
- Symbolic
Ref - A symbolic ref target.
- Version
TagName - A version-like tag name, such as
v1.2.3.
Enums§
- GitAttribute
Parse Error - Error returned while parsing attribute vocabulary.
- GitAttribute
State - Attribute state vocabulary.
- GitBranch
Name Error - Error returned while parsing branch names.
- GitConflict
Status - Conflict status vocabulary.
- GitFile
Change - File-change vocabulary.
- GitHead
- A lightweight
HEADvocabulary value. - GitIgnore
Negation - Pattern negation vocabulary.
- GitIgnore
Parse Error - Error returned while parsing ignore vocabulary.
- GitIgnore
Scope - Ignore rule classification.
- GitIndex
Status - Index-side status vocabulary.
- GitOid
Kind - Supported
Gitobject identifier text shapes. - GitOid
Parse Error - Error returned while parsing object identifier text.
- GitRef
Kind - A broad ref-name kind.
- GitRef
Parse Error - Error returned while parsing ref vocabulary.
- GitRemote
Kind - Remote kind vocabulary.
- GitRemote
Name Error - Error returned while parsing remote vocabulary.
- GitStatus
Parse Error - Error returned while parsing status vocabulary.
- GitTag
Kind - Tag storage vocabulary.
- GitTag
Name Error - Error returned while parsing tag names.
- GitWorktree
Status - Worktree-side status vocabulary.
- Pathspec
Magic - Common pathspec magic labels.
- Pathspec
Parse Error - Error returned while parsing pathspec vocabulary.
- Pathspec
Scope - Pathspec scope vocabulary.
- Refspec
Direction - Refspec direction vocabulary.
- Refspec
Mode - Refspec force mode vocabulary.
- Refspec
Parse Error - Error returned while parsing refspec vocabulary.
- Revision
Parse Error - Error returned while parsing revision vocabulary.
- Revision
Range Kind - Revision range spelling.
- Revision
Selector - A revision selector classification.
- Revision
Suffix - A revision suffix such as
^or~2.