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