Expand description
Git operations for Ironflow workflows, powered by git2.
This crate provides a comprehensive set of Git operations as Ironflow
Operation implementations. Each
operation wraps a git2 API call, running it inside
spawn_blocking since git2 is synchronous.
§Architecture
GitRepois the central handle, wrapping a repository path- Each operation is a standalone struct implementing
Operation - All operations return
kind() == "git" - Parameters are set at construction time, not via
OperationContext
§Quick start
use ironflow_ops_git::GitRepo;
use ironflow_ops_git::repository::RepoInit;
use ironflow_ops_git::commit::CommitCreate;
use ironflow_ops_git::index::IndexAdd;
use ironflow_core::operation::{Operation, OperationContext, NoopSecretResolver};
use std::sync::Arc;
let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
// Initialize a repo
let init = RepoInit::new("/tmp/my-repo", false);
init.execute(&ctx).await?;
// Stage a file and commit
let add = IndexAdd::new("/tmp/my-repo", "README.md");
add.execute(&ctx).await?;
let commit = CommitCreate::new("/tmp/my-repo", "Initial commit", "Alice", "alice@example.com");
commit.execute(&ctx).await?;§Tracked operations
Every operation implements Operation,
so it can be passed to WorkflowContext::operation() for step lifecycle
tracking (step record, status transitions, duration, output persistence).
§Modules
Operations are organized by Git domain:
| Module | Operations |
|---|---|
repository | Init, Open, Clone, Discover, State |
index | Add, AddAll, Remove, RemoveAll, UpdateAll, WriteTree |
commit | Create, Find, Amend, Signed |
branch | Create, Delete, Rename, List, Lookup, IsHead, SetUpstream |
tag | CreateLightweight, CreateAnnotated, Delete, List, ListMatch |
remote | Create, Delete, Rename, SetUrl, List, Lookup |
fetch | Fetch, Push, Prune, DefaultBranch |
merge | Branch, Analysis, Commits, Base, CleanupState |
rebase | Init, Next, Commit, Abort, Finish |
cherrypick | Cherrypick, CherrypickCommit, Revert, RevertCommit |
stash | Save, Apply, Pop, Drop, List |
diff | TreeToTree, TreeToIndex, IndexToWorkdir, Stats, FindSimilar, Apply |
checkout | Head, Index, Tree |
blame | BlameFile |
log | RevwalkNew, RevwalkPushRange, RevwalkSimplifyFirstParent |
refs | Create, Delete, Rename, Lookup, NameToId |
reflog | Read, Append, Drop |
submodule | Add, Init, Update, Lookup, List |
worktree | Add, List, Validate, Prune |
config | Get, Set, Delete, List |
status | File, List, ShouldIgnore |
reset | Reset (soft, mixed, hard) |
graph | AheadBehind, DescendantOf, Describe |
object | BlobCreate, TreeLookup, FindObject |
Re-exports§
pub use git2;
Modules§
- blame
- Blame operations.
- branch
- Branch operations.
- checkout
- Checkout operations.
- cherrypick
- Cherry-pick and revert operations.
- commit
- Commit operations.
- config
- Git config operations.
- diff
- Diff operations.
- fetch
- Fetch and push operations.
- graph
- Graph operations (ahead/behind, descendant, describe).
- index
- Index / staging area operations.
- log
- Log / history operations.
- merge
- Merge operations.
- object
- Object operations (blob, tree, find).
- rebase
- Rebase operations.
- reflog
- Reflog operations.
- refs
- Reference operations.
- remote
- Remote operations.
- repository
- Repository-level operations: init, open, clone, discover, state.
- reset
- Reset operations.
- stash
- Stash operations.
- status
- Status operations.
- submodule
- Submodule operations.
- tag
- Tag operations.
- worktree
- Worktree operations.
Structs§
- GitRepo
- A handle to a local Git repository, identified by its working directory path.