Skip to main content

Crate ironflow_ops_git

Crate ironflow_ops_git 

Source
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

  • 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;

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:

ModuleOperations
repositoryInit, Open, Clone, Discover, State
indexAdd, AddAll, Remove, RemoveAll, UpdateAll, WriteTree
commitCreate, Find, Amend, Signed
branchCreate, Delete, Rename, List, Lookup, IsHead, SetUpstream
tagCreateLightweight, CreateAnnotated, Delete, List, ListMatch
remoteCreate, Delete, Rename, SetUrl, List, Lookup
fetchFetch, Push, Prune, DefaultBranch
mergeBranch, Analysis, Commits, Base, CleanupState
rebaseInit, Next, Commit, Abort, Finish
cherrypickCherrypick, CherrypickCommit, Revert, RevertCommit
stashSave, Apply, Pop, Drop, List
diffTreeToTree, TreeToIndex, IndexToWorkdir, Stats, FindSimilar, Apply
checkoutHead, Index, Tree
blameBlameFile
logRevwalkNew, RevwalkPushRange, RevwalkSimplifyFirstParent
refsCreate, Delete, Rename, Lookup, NameToId
reflogRead, Append, Drop
submoduleAdd, Init, Update, Lookup, List
worktreeAdd, List, Validate, Prune
configGet, Set, Delete, List
statusFile, List, ShouldIgnore
resetReset (soft, mixed, hard)
graphAheadBehind, DescendantOf, Describe
objectBlobCreate, 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.