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
- [
GitRepo] is 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;
# async fn example() -> Result<(), ironflow_core::error::OperationError> {
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?;
# Ok(())
# }
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 |