1mod branch;
9mod cancel_cleanup;
10mod checkout;
11mod command_run;
12mod commit;
13mod conflicts;
14mod content;
15mod convert_ops;
16mod count;
17mod diff;
18mod discard;
19mod discover;
20mod file_history;
21mod history;
22mod history_ops;
23mod index_scan;
24mod journal_ops;
25#[cfg(feature = "lfs")]
26mod lfs;
27#[cfg(not(feature = "lfs"))]
28#[path = "lfs_stub.rs"]
29mod lfs;
30#[cfg(feature = "lfs")]
31mod lfs_locks;
32#[cfg(not(feature = "lfs"))]
33#[path = "lfs_locks_stub.rs"]
34mod lfs_locks;
35#[cfg(feature = "lfs")]
36mod lfs_network;
37#[cfg(not(feature = "lfs"))]
38#[path = "lfs_network_stub.rs"]
39mod lfs_network;
40mod log;
41mod messages;
42mod network;
43mod operation;
44mod patch;
45mod patch_file;
46mod predict;
47mod process;
48mod prune;
49mod rebase_interactive;
50mod reflog_ops;
51mod refs;
52mod remote_access;
53mod remote_ref;
54mod remotes;
55mod reset;
56mod reword;
57mod rewrite;
58mod rule_files;
59mod scoped_config;
60mod snapshot_ops;
61mod sparse;
62mod split;
63mod staging;
64mod stash_ops;
65mod stashes;
66mod status;
67mod stream;
68mod stuck;
69#[cfg(feature = "submodule")]
70mod submodules;
71#[cfg(not(feature = "submodule"))]
72#[path = "submodules_stub.rs"]
73mod submodules;
74mod tags;
75mod tools;
76mod tree_kill;
77mod tree_warnings;
78mod worktree_list;
79#[cfg(feature = "worktree")]
80mod worktrees;
81#[cfg(not(feature = "worktree"))]
82#[path = "worktrees_stub.rs"]
83mod worktrees;
84
85use std::path::{Path, PathBuf};
86
87use gitpoulpi_core::domain::rewrite::{
88 Recipe, RewriteOutcome, RewritePlan, RewriteProgressSink, RunId,
89};
90use gitpoulpi_core::domain::*;
91use gitpoulpi_core::{GitBackend, Result};
92
93pub use cancel_cleanup::remove_stale_transfer_files;
101pub use command_run::{run_command, CommandOutput, CommandRunError};
102pub use content::{body_of, lfs_local_object};
103pub use reflog_ops::reflog_via_git;
104pub use refs::{apply_tag_sync, tag_sync_for};
105pub use scoped_config::{
106 config_entries, credential_helper_entries, global_ssh_program, machine_wide_helpers,
107 ssh_command_entries, ConfigEntry,
108};
109
110pub use journal_ops::{
113 check_section as check_config_section, dependents_in as remote_dependents_in,
114 in_section as config_key_in_section, is_key_section as is_config_key_section,
115};
116
117pub use process::{
120 credential_mode, expand_home, git_program, set_credential_mode, set_ssh_key,
121 ssh_key_command as global_ssh_key_command, CredentialMode,
122};
123
124pub use conflicts::{document_from_stages, git_dir};
127pub use process::total_spawn_count;
129pub use prune::prune_empty_parents;
130pub use snapshot_ops::{
131 normalize_all as snapshot_normalize_all, remove_any as snapshot_remove_any,
132 walk as snapshot_walk, write_file as snapshot_write_file, MODE_LINK,
133};
134
135pub struct SystemGitBackend {
136 lfs_probe: lfs::LfsProbe,
138 tool_probe: tools::ToolProbe,
140}
141
142impl SystemGitBackend {
143 pub fn new() -> Self {
144 Self {
145 lfs_probe: lfs::LfsProbe::default(),
146 tool_probe: tools::ToolProbe::default(),
147 }
148 }
149}
150
151impl SystemGitBackend {
152 pub fn without_lfs() -> Self {
158 Self {
159 lfs_probe: lfs::LfsProbe::forced(LfsBinary::Missing),
160 tool_probe: tools::ToolProbe::forced(
161 gitpoulpi_core::domain::rewrite::Tool::GitLfs,
162 gitpoulpi_core::domain::rewrite::ToolStatus::Missing,
163 ),
164 }
165 }
166}
167
168impl Default for SystemGitBackend {
169 fn default() -> Self {
170 Self::new()
171 }
172}
173
174#[async_trait::async_trait]
175impl GitBackend for SystemGitBackend {
176 fn name(&self) -> &'static str {
177 "system"
178 }
179
180 fn discover(&self, path: &Path) -> Result<DiscoveredRepo> {
181 discover::discover(path)
182 }
183
184 fn init(&self, path: &Path, opts: &InitOptions) -> Result<RepoRef> {
185 discover::init(path, opts)
186 }
187
188 fn status(&self, repo: &RepoRef) -> Result<WorkingTree> {
189 status::status(repo)
190 }
191 fn log(&self, repo: &RepoRef, opts: &LogOptions) -> Result<CommitGraph> {
192 log::log(repo, opts)
193 }
194 fn count_commits(&self, repo: &RepoRef, opts: &LogOptions) -> Result<u64> {
195 count::count_commits(repo, opts)
196 }
197 fn ref_snapshot(&self, repo: &RepoRef, scope: &RefScope) -> Result<RefSnapshot> {
198 journal_ops::ref_snapshot(repo, scope)
199 }
200 fn update_refs(
201 &self,
202 repo: &RepoRef,
203 updates: &[RefUpdate],
204 reflog_message: &str,
205 ) -> Result<()> {
206 journal_ops::update_refs(repo, updates, reflog_message)
207 }
208 fn move_head_keep(&self, repo: &RepoRef, branch: &str, from: Oid, to: Oid) -> Result<()> {
209 journal_ops::move_head_keep(repo, branch, from, to)
210 }
211 fn index_tree(&self, repo: &RepoRef) -> Result<Oid> {
212 snapshot_ops::index_tree(repo)
213 }
214 fn index_restore(&self, repo: &RepoRef, tree: Oid) -> Result<()> {
215 snapshot_ops::index_restore(repo, tree)
216 }
217 fn snapshot_create(&self, repo: &RepoRef, paths: &[String]) -> Result<Snapshot> {
218 snapshot_ops::snapshot_create(repo, paths)
219 }
220 fn snapshot_restore(&self, repo: &RepoRef, snapshot: Oid, paths: &[String]) -> Result<()> {
221 snapshot_ops::snapshot_restore(repo, snapshot, paths)
222 }
223 fn path_hashes(&self, repo: &RepoRef, paths: &[String]) -> Result<Vec<PathHash>> {
224 snapshot_ops::path_hashes(repo, paths)
225 }
226 fn blob_bytes(&self, repo: &RepoRef, oid: Oid) -> Result<Vec<u8>> {
227 reflog_ops::blob_bytes(repo, oid)
228 }
229 fn reflog(
230 &self,
231 repo: &RepoRef,
232 refname: &str,
233 skip: usize,
234 limit: usize,
235 ) -> Result<gitpoulpi_core::domain::ReflogPage> {
236 reflog_ops::reflog(repo, refname, skip, limit)
237 }
238 fn lost_commits(
239 &self,
240 repo: &RepoRef,
241 opts: &gitpoulpi_core::domain::LostCommitOptions,
242 ) -> Result<gitpoulpi_core::domain::LostCommitsPage> {
243 reflog_ops::lost_commits(repo, opts)
244 }
245 fn delete_files(&self, repo: &RepoRef, paths: &[String]) -> Result<()> {
246 snapshot_ops::delete_files(repo, paths)
247 }
248 fn convert_files(
249 &self,
250 repo: &RepoRef,
251 paths: &[String],
252 op: gitpoulpi_core::textconv::ConvertOp,
253 ) -> Result<gitpoulpi_core::textconv::ConvertReport> {
254 convert_ops::convert_files(repo, paths, op)
255 }
256 fn gitignore_add(&self, repo: &RepoRef, pattern: &str, file: Option<&str>) -> Result<bool> {
257 rule_files::gitignore_add(repo, pattern, file)
258 }
259 fn gitattributes_treat(
260 &self,
261 repo: &RepoRef,
262 paths: &[String],
263 scope: gitpoulpi_core::domain::RuleScope,
264 file: Option<&str>,
265 treat: gitpoulpi_core::domain::Treat,
266 ) -> Result<gitpoulpi_core::domain::AttributesWrite> {
267 rule_files::gitattributes_treat(repo, paths, scope, file, treat)
268 }
269 fn mailmap_resolve(
270 &self,
271 repo: &RepoRef,
272 idents: &[gitpoulpi_core::domain::rewrite::Ident],
273 ) -> Result<Vec<gitpoulpi_core::domain::rewrite::Ident>> {
274 history::mailmap_resolve(repo, idents)
275 }
276 fn mailmap_identities(
277 &self,
278 repo: &RepoRef,
279 scope: &gitpoulpi_core::domain::rewrite::Scope,
280 options: &gitpoulpi_core::domain::rewrite::ScopeOptions,
281 ) -> Result<gitpoulpi_core::domain::rewrite::IdentityList> {
282 history::mailmap_identities(repo, scope, options)
283 }
284 fn mailmap_add(
285 &self,
286 repo: &RepoRef,
287 canonical: &gitpoulpi_core::domain::rewrite::Ident,
288 from: &[gitpoulpi_core::domain::rewrite::Ident],
289 file: Option<&str>,
290 ) -> Result<gitpoulpi_core::domain::rewrite::MailmapAdded> {
291 history::mailmap_add(repo, canonical, from, file)
292 }
293 fn binary_paths(&self, repo: &RepoRef, paths: &[String]) -> Result<Vec<bool>> {
294 rule_files::binary_paths(repo, paths)
295 }
296 fn patch_files(&self, repo: &RepoRef, patch: &Path) -> Result<Vec<String>> {
297 snapshot_ops::patch_files(repo, patch)
298 }
299 fn config_section(&self, repo: &RepoRef, section: &str) -> Result<Vec<(String, String)>> {
300 journal_ops::config_section(repo, section)
301 }
302 fn config_sections(
303 &self,
304 repo: &RepoRef,
305 sections: &[String],
306 ) -> Result<Vec<gitpoulpi_core::backend::ConfigSection>> {
307 journal_ops::config_sections(repo, sections)
308 }
309 fn remote_dependents(&self, repo: &RepoRef, remote: &str) -> Result<Vec<String>> {
310 journal_ops::remote_dependents(repo, remote)
311 }
312 fn set_config_section(
313 &self,
314 repo: &RepoRef,
315 section: &str,
316 entries: &[(String, String)],
317 ) -> Result<()> {
318 journal_ops::set_config_section(repo, section, entries)
319 }
320 fn diff(&self, repo: &RepoRef, target: DiffTarget) -> Result<Vec<FileDiff>> {
321 diff::diff(repo, target)
322 }
323 fn diff_files(&self, repo: &RepoRef, target: DiffTarget) -> Result<DiffFileList> {
324 diff::diff_files(repo, target)
325 }
326 fn commit_stats(&self, repo: &RepoRef, ids: &[Oid]) -> Result<Vec<CommitStat>> {
327 diff::commit_stats(repo, ids)
328 }
329 fn commit_messages(
330 &self,
331 repo: &RepoRef,
332 query: &gitpoulpi_core::domain::CommitMessagesQuery,
333 ) -> Result<gitpoulpi_core::domain::CommitMessages> {
334 messages::commit_messages(repo, query)
335 }
336 fn diff_paths(
337 &self,
338 repo: &RepoRef,
339 target: DiffTarget,
340 paths: &[PathBuf],
341 ) -> Result<Vec<FileDiff>> {
342 diff::diff_paths(repo, target, paths)
343 }
344 fn refs(&self, repo: &RepoRef) -> Result<Vec<Ref>> {
345 refs::refs(repo)
346 }
347 fn stashes(&self, repo: &RepoRef) -> Result<Vec<Stash>> {
348 stashes::stashes(repo)
349 }
350 fn remotes(&self, repo: &RepoRef) -> Result<Vec<Remote>> {
351 remotes::remotes(repo)
352 }
353 fn leftover_remotes(&self, repo: &RepoRef) -> Result<Vec<String>> {
354 remotes::leftover_remotes(repo)
355 }
356 fn worktrees(&self, repo: &RepoRef) -> Result<Vec<Worktree>> {
357 worktrees::worktrees(repo)
358 }
359 fn submodules(&self, repo: &RepoRef) -> Result<Vec<Submodule>> {
360 submodules::submodules(repo)
361 }
362 fn submodule_init(&self, repo: &RepoRef, paths: &[String]) -> Result<()> {
363 submodules::submodule_init(repo, paths)
364 }
365 fn submodule_update(&self, repo: &RepoRef, opts: &SubmoduleUpdateOptions) -> Result<()> {
366 submodules::submodule_update(repo, opts)
367 }
368 fn resolve(&self, repo: &RepoRef, rev: &str) -> Result<Oid> {
369 refs::resolve(repo, rev)
370 }
371 fn merge_base(&self, repo: &RepoRef, a: Oid, b: Oid) -> Result<Option<Oid>> {
372 refs::merge_base(repo, a, b)
373 }
374 fn ahead_behind(&self, repo: &RepoRef, tip: Oid, base: Oid) -> Result<(u32, u32)> {
375 refs::ahead_behind(repo, tip, base)
376 }
377 fn cherry_counts(&self, repo: &RepoRef, local: Oid, remote: Oid) -> Result<(u32, u32)> {
378 refs::cherry_counts(repo, local, remote)
379 }
380 fn predict_merge_conflicts(
381 &self,
382 repo: &RepoRef,
383 ours: Oid,
384 theirs: Oid,
385 ) -> Result<Vec<String>> {
386 predict::predict_merge_conflicts(repo, ours, theirs)
387 }
388 fn read_blob(&self, repo: &RepoRef, path: &Path, source: &BlobSource) -> Result<Blob> {
389 content::read_blob(repo, path, source)
390 }
391 fn read_blob_bytes(
392 &self,
393 repo: &RepoRef,
394 path: &Path,
395 source: &BlobSource,
396 max: u64,
397 ) -> Result<gitpoulpi_core::domain::BlobBytes> {
398 content::read_blob_bytes(repo, path, source, max)
399 }
400 fn list_tree(&self, repo: &RepoRef, at: Oid) -> Result<Vec<PathBuf>> {
401 content::list_tree(repo, at)
402 }
403 fn grep_tree(
404 &self,
405 repo: &RepoRef,
406 at: Oid,
407 terms: &[String],
408 max_hits: usize,
409 ) -> Result<Vec<gitpoulpi_core::domain::GrepHit>> {
410 content::grep_tree(repo, at, terms, max_hits)
411 }
412
413 fn blame(&self, repo: &RepoRef, path: &Path, at: Oid) -> Result<Blame> {
414 content::blame(repo, path, at)
415 }
416 fn file_history(
417 &self,
418 repo: &RepoRef,
419 path: &Path,
420 start: Oid,
421 skip: usize,
422 limit: usize,
423 ) -> Result<gitpoulpi_core::domain::FileHistoryPage> {
424 file_history::file_history(repo, path, start, skip, limit)
425 }
426 fn stage(&self, repo: &RepoRef, target: &StageTarget) -> Result<()> {
427 staging::stage(repo, target)
428 }
429 fn unstage(&self, repo: &RepoRef, target: &StageTarget) -> Result<()> {
430 staging::unstage(repo, target)
431 }
432 fn commit(&self, repo: &RepoRef, message: &str, opts: &CommitOptions) -> Result<Oid> {
433 commit::commit(repo, message, opts)
434 }
435 fn checkout(&self, repo: &RepoRef, target: &CheckoutTarget) -> Result<()> {
436 tree_warnings::watch(&repo.root, || checkout::checkout(repo, target))
437 }
438 fn discard(&self, repo: &RepoRef, paths: &[String]) -> Result<()> {
439 discard::discard(repo, paths)
440 }
441 fn discard_part(&self, repo: &RepoRef, target: &DiscardTarget) -> Result<()> {
442 staging::discard_part(repo, target)
443 }
444 fn branch_create(&self, repo: &RepoRef, name: &str, at: Oid) -> Result<()> {
445 branch::branch_create(repo, name, at)
446 }
447 fn branch_create_tracking(
448 &self,
449 repo: &RepoRef,
450 local_name: &str,
451 upstream: &str,
452 ) -> Result<()> {
453 tree_warnings::watch(&repo.root, || {
454 branch::branch_create_tracking(repo, local_name, upstream)
455 })
456 }
457 fn branch_delete(&self, repo: &RepoRef, name: &str) -> Result<()> {
458 branch::branch_delete(repo, name)
459 }
460 fn branch_rename(&self, repo: &RepoRef, old_name: &str, new_name: &str) -> Result<()> {
461 branch::branch_rename(repo, old_name, new_name)
462 }
463 fn branch_set_upstream(
464 &self,
465 repo: &RepoRef,
466 branch: &str,
467 upstream: Option<&str>,
468 ) -> Result<()> {
469 branch::branch_set_upstream(repo, branch, upstream)
470 }
471 fn fast_forward(
472 &self,
473 repo: &RepoRef,
474 branch: &str,
475 target: Oid,
476 ) -> Result<FastForwardOutcome> {
477 tree_warnings::watch(&repo.root, || branch::fast_forward(repo, branch, target))
478 }
479 fn worktree_add(
480 &self,
481 repo: &RepoRef,
482 path: &Path,
483 opts: &WorktreeAddOptions,
484 ) -> Result<Worktree> {
485 worktrees::worktree_add(repo, path, opts)
486 }
487 fn worktree_changes(&self, repo: &RepoRef, path: &Path) -> Result<Vec<WorktreeChange>> {
488 worktrees::worktree_changes(repo, path)
489 }
490 fn worktree_remove(
491 &self,
492 repo: &RepoRef,
493 path: &Path,
494 opts: &WorktreeRemoveOptions,
495 ) -> Result<WorktreeRemoved> {
496 worktrees::worktree_remove(repo, path, opts)
497 }
498 fn patch_create(
499 &self,
500 repo: &RepoRef,
501 source: &PatchSource,
502 dest: &Path,
503 ) -> Result<PatchCreated> {
504 patch_file::patch_create(repo, source, dest)
505 }
506 fn patch_apply(&self, repo: &RepoRef, patch: &Path) -> Result<PatchApplied> {
507 patch_file::patch_apply(repo, patch)
508 }
509
510 fn apply_commit_to_worktree(&self, repo: &RepoRef, commit: Oid) -> Result<PatchApplied> {
511 patch_file::apply_commit_to_worktree(repo, commit)
512 }
513 fn tag_create(
514 &self,
515 repo: &RepoRef,
516 name: &str,
517 at: Oid,
518 annotated_message: Option<&str>,
519 ) -> Result<()> {
520 branch::tag_create(repo, name, at, annotated_message)
521 }
522 fn tag_delete(&self, repo: &RepoRef, name: &str) -> Result<()> {
523 branch::tag_delete(repo, name)
524 }
525 fn tag_annotate(&self, repo: &RepoRef, name: &str, message: &str) -> Result<()> {
526 tags::tag_annotate(repo, name, message)
527 }
528 fn tag_move(&self, repo: &RepoRef, name: &str, to: Oid, force: bool) -> Result<()> {
529 tags::tag_move(repo, name, to, force)
530 }
531 fn tag_merge_branch(
532 &self,
533 repo: &RepoRef,
534 name: &str,
535 branch: &str,
536 message: Option<&str>,
537 ) -> Result<Oid> {
538 tags::tag_merge_branch(repo, name, branch, message)
539 }
540 async fn tag_push(
541 &self,
542 repo: &RepoRef,
543 remote: &str,
544 selection: &TagSelection,
545 ) -> Result<PushOutcome> {
546 tags::tag_push(repo, remote, selection).await
547 }
548 fn tag_take_remote(&self, repo: &RepoRef, remote: &str, name: &str) -> Result<()> {
549 tags::tag_take_remote(repo, remote, name)
550 }
551 async fn tag_force_push(&self, repo: &RepoRef, remote: &str, name: &str) -> Result<()> {
552 tags::tag_force_push(repo, remote, name).await
553 }
554 async fn tag_delete_remote(&self, repo: &RepoRef, remote: &str, name: &str) -> Result<()> {
555 tags::tag_delete_remote(repo, remote, name).await
556 }
557 async fn tag_fetch(&self, repo: &RepoRef, remote: &str, name: &str) -> Result<()> {
558 tags::tag_fetch(repo, remote, name).await
559 }
560 async fn branch_delete_remote(&self, repo: &RepoRef, remote: &str, name: &str) -> Result<()> {
561 branch::branch_delete_remote(repo, remote, name).await
562 }
563 async fn remote_ref_value(
564 &self,
565 repo: &RepoRef,
566 remote: &str,
567 full_ref: &str,
568 ) -> Result<Option<Oid>> {
569 remote_ref::remote_ref_value(repo, remote, full_ref).await
570 }
571 async fn remote_ref_update(
572 &self,
573 repo: &RepoRef,
574 remote: &str,
575 full_ref: &str,
576 new: Option<Oid>,
577 expect: Option<Oid>,
578 ) -> Result<()> {
579 remote_ref::remote_ref_update(repo, remote, full_ref, new, expect).await
580 }
581 fn merge(&self, repo: &RepoRef, from: &Ref, opts: &MergeOptions) -> Result<MergeOutcome> {
582 tree_warnings::watch(&repo.root, || history_ops::merge(repo, from, opts))
583 }
584 fn rebase(&self, repo: &RepoRef, onto: &Ref, opts: &RebaseOptions) -> Result<RebaseOutcome> {
585 tree_warnings::watch(&repo.root, || history_ops::rebase(repo, onto, opts))
586 }
587 fn rebase_plan(&self, repo: &RepoRef, upstream: Option<Oid>) -> Result<RebasePlanDraft> {
588 rebase_interactive::rebase_plan(repo, upstream)
589 }
590 fn rebase_interactive(&self, repo: &RepoRef, req: &InteractiveRebase) -> Result<RebaseOutcome> {
591 tree_warnings::watch(&repo.root, || {
592 rebase_interactive::rebase_interactive(repo, req)
593 })
594 }
595 fn rebase_state(&self, repo: &RepoRef) -> Result<Option<RebaseState>> {
596 rebase_interactive::rebase_state(repo)
597 }
598 fn rebase_continue(&self, repo: &RepoRef) -> Result<RebaseOutcome> {
599 tree_warnings::watch(&repo.root, || rebase_interactive::rebase_continue(repo))
600 }
601 fn rebase_skip(&self, repo: &RepoRef) -> Result<RebaseOutcome> {
602 tree_warnings::watch(&repo.root, || rebase_interactive::rebase_skip(repo))
603 }
604 fn rebase_abort(&self, repo: &RepoRef) -> Result<()> {
605 rebase_interactive::rebase_abort(repo)
606 }
607 fn cherry_pick(
608 &self,
609 repo: &RepoRef,
610 commits: &[Oid],
611 opts: &CherryPickOptions,
612 ) -> Result<CherryPickOutcome> {
613 tree_warnings::watch(&repo.root, || history_ops::cherry_pick(repo, commits, opts))
614 }
615 fn revert(&self, repo: &RepoRef, commit: Oid, mainline: Option<u32>) -> Result<RevertOutcome> {
616 tree_warnings::watch(&repo.root, || history_ops::revert(repo, commit, mainline))
617 }
618 fn reset(&self, repo: &RepoRef, target: Oid, mode: ResetMode) -> Result<()> {
619 tree_warnings::watch(&repo.root, || reset::reset(repo, target, mode))
620 }
621 fn reword(&self, repo: &RepoRef, commit: Oid, message: &str) -> Result<RewordOutcome> {
622 reword::reword(repo, commit, message)
623 }
624 fn amend_commit(
625 &self,
626 repo: &RepoRef,
627 commit: Oid,
628 amend: &gitpoulpi_core::domain::CommitAmend,
629 ) -> Result<RewordOutcome> {
630 reword::amend_commit(repo, commit, amend, "amend")
631 }
632 fn split_source(&self, repo: &RepoRef, commit: Oid) -> Result<SplitSource> {
633 split::split_source(repo, commit)
634 }
635 fn split_commit(&self, repo: &RepoRef, req: &SplitCommit) -> Result<SplitOutcome> {
636 split::split_commit(repo, req)
637 }
638 fn rewrite_preview(
641 &self,
642 repo: &RepoRef,
643 recipe: &Recipe,
644 progress: RewriteProgressSink<'_>,
645 ) -> Result<RewritePlan> {
646 history::preview(repo, recipe, &self.tool_probe, progress)
647 }
648 fn rewrite_apply(&self, repo: &RepoRef, plan: &RewritePlan) -> Result<RewriteOutcome> {
649 history::apply(repo, plan)
650 }
651 fn rewrite_extract(
652 &self,
653 repo: &RepoRef,
654 plan: &RewritePlan,
655 target: &std::path::Path,
656 ) -> Result<RewriteOutcome> {
657 history::extract_to(repo, plan, target, &self.tool_probe)
658 }
659 fn rewrite_load(&self, repo: &RepoRef, run: &RunId) -> Result<Option<RewritePlan>> {
660 history::load(repo, run)
661 }
662 fn rewrite_record(
663 &self,
664 repo: &RepoRef,
665 run: &RunId,
666 ) -> Result<gitpoulpi_core::domain::rewrite::RewriteRecord> {
667 history::record(repo, run)
668 }
669 fn rewrite_maps(
670 &self,
671 repo: &RepoRef,
672 run: &RunId,
673 out: Option<&Path>,
674 ) -> Result<gitpoulpi_core::domain::rewrite::RewriteMaps> {
675 history::maps(repo, run, out)
676 }
677 async fn push_rewritten(
678 &self,
679 repo: &RepoRef,
680 req: &gitpoulpi_core::domain::rewrite::PushRewritten,
681 ) -> Result<gitpoulpi_core::domain::rewrite::PushRewrittenOutcome> {
682 history::push_rewritten(repo, req).await
683 }
684 fn rewrite_purge(
685 &self,
686 repo: &RepoRef,
687 req: &gitpoulpi_core::domain::rewrite::PurgeRequest,
688 progress: gitpoulpi_core::domain::rewrite::PurgeProgressSink<'_>,
689 ) -> Result<gitpoulpi_core::domain::rewrite::PurgeOutcome> {
690 history::purge(repo, req, progress)
691 }
692 fn rewrite_blob_diff(
693 &self,
694 repo: &RepoRef,
695 run: &RunId,
696 commit: Oid,
697 path: &str,
698 ) -> Result<gitpoulpi_core::domain::rewrite::BlobChange> {
699 history::blob_diff(repo, run, commit, path)
700 }
701 fn rewrite_script_check(
702 &self,
703 repo: &RepoRef,
704 script: &gitpoulpi_core::domain::rewrite::ScriptRef,
705 policy: &gitpoulpi_core::domain::rewrite::ScriptPolicy,
706 ) -> Result<gitpoulpi_core::domain::rewrite::script::ScriptCheck> {
707 history::script_check(repo, script, policy, &self.tool_probe)
708 }
709 fn rewrite_script_test(
710 &self,
711 repo: &RepoRef,
712 script: &gitpoulpi_core::domain::rewrite::ScriptRef,
713 policy: &gitpoulpi_core::domain::rewrite::ScriptPolicy,
714 commits: &[Oid],
715 ) -> Result<Vec<gitpoulpi_core::domain::rewrite::script::ScriptTestRow>> {
716 history::script_test(repo, script, policy, &self.tool_probe, commits)
717 }
718 fn rewrite_scan_secrets(
719 &self,
720 repo: &RepoRef,
721 scope: &gitpoulpi_core::domain::rewrite::Scope,
722 progress: gitpoulpi_core::domain::rewrite::RewriteProgressSink<'_>,
723 ) -> Result<gitpoulpi_core::domain::rewrite::SecretScan> {
724 history::scan_secrets(repo, scope, progress)
725 }
726 fn rewrite_analyze(
727 &self,
728 repo: &RepoRef,
729 scope: &gitpoulpi_core::domain::rewrite::Scope,
730 top: u32,
731 progress: gitpoulpi_core::domain::rewrite::RewriteProgressSink<'_>,
732 ) -> Result<gitpoulpi_core::domain::rewrite::SizeAnalysis> {
733 history::analyze(repo, scope, top, progress)
734 }
735 fn rewrite_discard(&self, repo: &RepoRef, run: &RunId) -> Result<()> {
736 history::discard(repo, run)
737 }
738 fn stash_push(
739 &self,
740 repo: &RepoRef,
741 message: Option<&str>,
742 include_untracked: bool,
743 ) -> Result<Option<StashId>> {
744 stash_ops::stash_push(repo, message, include_untracked)
745 }
746 fn stash_push_paths(
747 &self,
748 repo: &RepoRef,
749 message: Option<&str>,
750 paths: &[String],
751 ) -> Result<Option<StashId>> {
752 stash_ops::stash_push_paths(repo, message, paths)
753 }
754 fn stash_pop(&self, repo: &RepoRef, id: StashId) -> Result<()> {
755 stash_ops::stash_pop(repo, id)
756 }
757 fn stash_apply(&self, repo: &RepoRef, id: StashId) -> Result<()> {
758 stash_ops::stash_apply(repo, id)
759 }
760 fn stash_drop(&self, repo: &RepoRef, id: StashId) -> Result<()> {
761 stash_ops::stash_drop(repo, id)
762 }
763 fn stash_store(&self, repo: &RepoRef, commit: Oid, message: &str) -> Result<()> {
764 stash_ops::stash_store(repo, commit, message)
765 }
766
767 fn stash_from_commit(&self, repo: &RepoRef, commit: Oid, message: Option<&str>) -> Result<Oid> {
768 stash_ops::stash_from_commit(repo, commit, message)
769 }
770 fn stash_paths(&self, repo: &RepoRef, commit: Oid) -> Result<Vec<String>> {
771 stash_ops::stash_paths(repo, commit)
772 }
773 fn set_network_auth(&self, repo: &RepoRef, auth: Option<NetworkAuth>) {
774 process::set_network_auth(&repo.root, auth);
775 }
776 async fn remote_access_check(
777 &self,
778 repo: &RepoRef,
779 remote: &str,
780 opts: &RemoteAccessOptions,
781 ) -> Result<RemoteAccessReport> {
782 remote_access::check(repo, remote, opts).await
783 }
784 async fn fetch(
785 &self,
786 repo: &RepoRef,
787 remote: &str,
788 opts: &FetchOptions,
789 ) -> Result<FetchOutcome> {
790 network::fetch(repo, remote, opts).await
791 }
792 async fn fetch_all(&self, repo: &RepoRef, opts: &FetchOptions) -> Result<FetchOutcome> {
793 network::fetch_all(repo, opts).await
794 }
795 async fn fetch_ref_as_branch(
796 &self,
797 repo: &RepoRef,
798 remote: &str,
799 remote_ref: &str,
800 branch: &str,
801 ) -> Result<FetchOutcome> {
802 network::fetch_ref_as_branch(repo, remote, remote_ref, branch).await
803 }
804 async fn fetch_refspec(
805 &self,
806 repo: &RepoRef,
807 remote: &str,
808 refspec: &str,
809 ) -> Result<FetchOutcome> {
810 network::fetch_refspec(repo, remote, refspec).await
811 }
812 async fn pull(&self, repo: &RepoRef, opts: &PullOptions) -> Result<PullOutcome> {
813 tree_warnings::watch_async(&repo.root, network::pull(repo, opts)).await
814 }
815 async fn pull_fetch(&self, repo: &RepoRef, opts: &PullOptions) -> Result<()> {
816 network::pull_fetch(repo, opts).await
817 }
818 async fn pull_integrate(&self, repo: &RepoRef, opts: &PullOptions) -> Result<PullOutcome> {
819 tree_warnings::watch_async(&repo.root, network::pull_integrate(repo, opts)).await
820 }
821 async fn push(&self, repo: &RepoRef, remote: &str, opts: &PushOptions) -> Result<PushOutcome> {
822 network::push(repo, remote, opts).await
823 }
824 async fn push_for_review(
825 &self,
826 repo: &RepoRef,
827 remote: &str,
828 branch: &str,
829 topic: Option<&str>,
830 ) -> Result<PushOutcome> {
831 network::push_for_review(repo, remote, branch, topic).await
832 }
833 async fn clone(&self, url: &str, dest: &Path, opts: &CloneOptions) -> Result<RepoRef> {
834 network::clone(url, dest, opts, &self.lfs_probe).await
835 }
836 async fn clone_with_progress(
837 &self,
838 url: &str,
839 dest: &Path,
840 opts: &CloneOptions,
841 progress: CloneProgressSink<'_>,
842 ) -> Result<RepoRef> {
843 network::clone_with_progress(url, dest, opts, &self.lfs_probe, progress).await
844 }
845 fn remote_add(&self, repo: &RepoRef, name: &str, url: &str) -> Result<()> {
846 network::remote_add(repo, name, url)
847 }
848 fn remote_remove(&self, repo: &RepoRef, name: &str) -> Result<()> {
849 remotes::remote_remove(repo, name)
850 }
851 fn remote_rename(&self, repo: &RepoRef, old_name: &str, new_name: &str) -> Result<()> {
852 remotes::remote_rename(repo, old_name, new_name)
853 }
854 fn remote_set_url(&self, repo: &RepoRef, name: &str, url: &str) -> Result<()> {
855 remotes::remote_set_url(repo, name, url)
856 }
857 fn remote_set_push_url(&self, repo: &RepoRef, name: &str, url: Option<&str>) -> Result<()> {
858 remotes::remote_set_push_url(repo, name, url)
859 }
860 fn ssh_command(&self, repo: &RepoRef) -> Result<Option<String>> {
861 remotes::ssh_command(repo)
862 }
863 fn set_ssh_command(&self, repo: &RepoRef, command: Option<&str>) -> Result<()> {
864 remotes::set_ssh_command(repo, command)
865 }
866 fn repo_config(&self, repo: &RepoRef, key: &str) -> Result<Option<String>> {
867 remotes::repo_config(repo, key)
868 }
869 fn sparse_checkout_status(&self, repo: &RepoRef) -> Result<SparseState> {
870 sparse::status(repo)
871 }
872 fn sparse_checkout_set(&self, repo: &RepoRef, dirs: &[String]) -> Result<()> {
873 sparse::set(repo, dirs)
874 }
875 fn sparse_checkout_disable(&self, repo: &RepoRef) -> Result<()> {
876 sparse::disable(repo)
877 }
878 fn set_repo_config(&self, repo: &RepoRef, key: &str, value: Option<&str>) -> Result<()> {
879 remotes::set_repo_config(repo, key, value)
880 }
881 fn config_entries(&self, repo: &RepoRef, prefixes: &[&str]) -> Result<Vec<(String, String)>> {
882 remotes::config_entries(repo, prefixes)
883 }
884 fn rewrite_tools(
885 &self,
886 repo: &RepoRef,
887 fresh: bool,
888 ) -> Result<gitpoulpi_core::domain::rewrite::RewriteTools> {
889 tools::rewrite_tools(repo, &self.tool_probe, fresh)
890 }
891 fn rewrite_check_signing(
892 &self,
893 repo: &RepoRef,
894 ) -> Result<gitpoulpi_core::domain::rewrite::SigningCheck> {
895 history::check_signing(repo, &self.tool_probe)
896 }
897 fn lfs_status(&self, repo: &RepoRef) -> Result<LfsRepoStatus> {
898 lfs::lfs_status(repo, &self.lfs_probe)
899 }
900 fn lfs_files(&self, repo: &RepoRef, at: Option<Oid>) -> Result<Vec<LfsFile>> {
901 lfs::lfs_files(repo, at)
902 }
903 fn lfs_install(&self, repo: &RepoRef, scope: LfsInstallScope) -> Result<()> {
904 lfs::lfs_install(repo, &self.lfs_probe, scope)
905 }
906 fn lfs_track(
907 &self,
908 repo: &RepoRef,
909 patterns: &[String],
910 opts: &LfsTrackOptions,
911 ) -> Result<Vec<LfsPattern>> {
912 lfs::lfs_track(repo, &self.lfs_probe, patterns, opts)
913 }
914 fn lfs_untrack(&self, repo: &RepoRef, patterns: &[String]) -> Result<Vec<LfsPattern>> {
915 lfs::lfs_untrack(repo, &self.lfs_probe, patterns)
916 }
917 fn lfs_prune(&self, repo: &RepoRef) -> Result<()> {
918 lfs::lfs_prune(repo, &self.lfs_probe)
919 }
920 async fn lfs_locks(&self, repo: &RepoRef, remote: &str) -> Result<Vec<LfsLock>> {
921 lfs_locks::lfs_locks(repo, &self.lfs_probe, remote).await
922 }
923 async fn lfs_lock(&self, repo: &RepoRef, remote: &str, path: &Path) -> Result<LfsLock> {
924 lfs_locks::lfs_lock(repo, &self.lfs_probe, remote, path).await
925 }
926 async fn lfs_unlock(
927 &self,
928 repo: &RepoRef,
929 remote: &str,
930 path: &Path,
931 force: bool,
932 ) -> Result<()> {
933 lfs_locks::lfs_unlock(repo, &self.lfs_probe, remote, path, force).await
934 }
935 async fn lfs_fetch(
936 &self,
937 repo: &RepoRef,
938 remote: &str,
939 opts: &LfsFetchOptions,
940 progress: LfsProgressSink<'_>,
941 ) -> Result<()> {
942 lfs_network::lfs_fetch(repo, &self.lfs_probe, remote, opts, progress).await
943 }
944 async fn lfs_pull(
945 &self,
946 repo: &RepoRef,
947 remote: &str,
948 progress: LfsProgressSink<'_>,
949 ) -> Result<()> {
950 lfs_network::lfs_pull(repo, &self.lfs_probe, remote, progress).await
951 }
952 async fn lfs_checkout(
953 &self,
954 repo: &RepoRef,
955 paths: &[PathBuf],
956 progress: LfsProgressSink<'_>,
957 ) -> Result<()> {
958 lfs_network::lfs_checkout(repo, &self.lfs_probe, paths, progress).await
959 }
960 async fn lfs_push(
961 &self,
962 repo: &RepoRef,
963 remote: &str,
964 opts: &LfsPushOptions,
965 progress: LfsProgressSink<'_>,
966 ) -> Result<()> {
967 lfs_network::lfs_push(repo, &self.lfs_probe, remote, opts, progress).await
968 }
969 fn conflicts(&self, repo: &RepoRef) -> Result<Vec<ConflictSet>> {
970 conflicts::conflicts(repo)
971 }
972 fn conflict_entries(&self, repo: &RepoRef) -> Result<Vec<ConflictEntry>> {
973 conflicts::conflict_entries(repo)
974 }
975 fn merge_document(&self, repo: &RepoRef, path: &Path) -> Result<MergeDocument> {
976 conflicts::merge_document(repo, path)
977 }
978 fn resolve_conflict(
979 &self,
980 repo: &RepoRef,
981 path: &Path,
982 resolution: ConflictResolution,
983 opts: &ResolveOptions,
984 ) -> Result<()> {
985 conflicts::resolve_conflict(repo, path, resolution, opts)
986 }
987 fn unresolve_conflict(&self, repo: &RepoRef, path: &Path, entry: &ConflictEntry) -> Result<()> {
988 conflicts::unresolve_conflict(repo, path, entry)
989 }
990 fn operation_state(&self, repo: &RepoRef) -> Result<Option<OperationState>> {
991 operation::operation_state(repo)
992 }
993 fn operation_abort(&self, repo: &RepoRef) -> Result<()> {
994 operation::operation_abort(repo)
995 }
996 fn am_continue(&self, repo: &RepoRef) -> Result<AmOutcome> {
997 stuck::am_continue(repo)
998 }
999 fn am_skip(&self, repo: &RepoRef) -> Result<AmOutcome> {
1000 stuck::am_skip(repo)
1001 }
1002 fn am_abort(&self, repo: &RepoRef) -> Result<()> {
1003 stuck::am_abort(repo)
1004 }
1005 fn index_lock(&self, repo: &RepoRef) -> Result<Option<IndexLock>> {
1006 stuck::index_lock(repo)
1007 }
1008 fn index_lock_remove(&self, repo: &RepoRef) -> Result<()> {
1009 stuck::index_lock_remove(repo)
1010 }
1011 fn operation_skip(&self, repo: &RepoRef) -> Result<()> {
1012 operation::operation_skip(repo)
1013 }
1014}