1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
//! Git operations for Ironflow workflows, powered by [`git2`].
//!
//! This crate provides a comprehensive set of Git operations as Ironflow
//! [`Operation`](ironflow_core::operation::Operation) implementations. Each
//! operation wraps a [`git2`] API call, running it inside
//! [`spawn_blocking`](tokio::task::spawn_blocking) since `git2` is synchronous.
//!
//! # Architecture
//!
//! - [`GitRepo`] is the central handle, wrapping a repository path
//! - Each operation is a standalone struct implementing [`Operation`](ironflow_core::operation::Operation)
//! - All operations return `kind() == "git"`
//! - Parameters are set at construction time, not via [`OperationContext`](ironflow_core::operation::OperationContext);
//! the context only provides the secrets network operations authenticate with
//!
//! # Authentication and secrets
//!
//! Operations that talk to a remote ([`RepoClone`](repository::RepoClone),
//! [`FetchRemote`](fetch::FetchRemote), [`PushRemote`](fetch::PushRemote),
//! [`RemotePrune`](fetch::RemotePrune),
//! [`RemoteDefaultBranch`](fetch::RemoteDefaultBranch),
//! [`SubmoduleUpdate`](submodule::SubmoduleUpdate)) authenticate over HTTPS
//! with the token held in the `git_token` secret, sent with the username
//! `oauth2`. Both are overridable per operation with `.token_secret(key)` and
//! `.username(name)`. Without that secret, they fall back to the SSH agent,
//! the git credential helper, then libgit2's default credential.
//!
//! The token never reaches a step record: credentials embedded in a URL are
//! masked as `***` in every `input()`, output and error message, and a token
//! resolved from the secret store is scrubbed from error messages.
//!
//! ```no_run
//! use ironflow_ops_git::repository::RepoClone;
//! use ironflow_core::operation::{OperationContext, NoopSecretResolver};
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<(), ironflow_core::error::OperationError> {
//! # let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
//! // Reads `gitlab_token` from the secret store.
//! RepoClone::new("https://gitlab.com/group/private.git", "/tmp/review.git")
//! .bare(true)
//! .token_secret("gitlab_token")
//! .run(&ctx)
//! .await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Quick start
//!
//! ```no_run
//! 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`](ironflow_core::operation::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, Checkout |
//! | [`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 (optionally detached at a commit), List, Validate, Prune, Remove |
//! | [`config`] | Get, Set, Delete, List |
//! | [`status`] | File, List, ShouldIgnore |
//! | [`reset`] | Reset (soft, mixed, hard) |
//! | [`graph`] | AheadBehind, DescendantOf, Describe |
//! | [`object`] | BlobCreate, TreeLookup, FindObject |
pub use git2;
pub use GitRepo;
pub