MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / create_recovery_commit

Function create_recovery_commit

atomic-repository/src/wip.rs:478–504  ·  view source on GitHub ↗
(
    root: &Path,
    tree_oid: &str,
    parent_oid: Option<&str>,
)

Source from the content-addressed store, hash-verified

476}
477
478fn create_recovery_commit(
479 root: &Path,
480 tree_oid: &str,
481 parent_oid: Option<&str>,
482) -> Result<String, WipCaptureError> {
483 let mut args = vec![OsString::from("commit-tree"), OsString::from(tree_oid)];
484 if let Some(parent_oid) = parent_oid {
485 args.push(OsString::from("-p"));
486 args.push(OsString::from(parent_oid));
487 }
488
489 let mut command = git_command(root, &args, None);
490 command
491 .env("GIT_AUTHOR_NAME", "Atomic Recovery")
492 .env("GIT_AUTHOR_EMAIL", "recovery@atomic.invalid")
493 .env("GIT_COMMITTER_NAME", "Atomic Recovery")
494 .env("GIT_COMMITTER_EMAIL", "recovery@atomic.invalid");
495 let output = execute_raw(
496 command,
497 "create neutral WIP commit",
498 Some(RECOVERY_COMMIT_MESSAGE.as_bytes()),
499 )?;
500 if !output.status.success() {
501 return Err(command_failure("create neutral WIP commit", &output));
502 }
503 output_text("create neutral WIP commit", output.stdout)
504}
505
506fn create_recovery_ref(
507 root: &Path,

Callers 1

create_prepared_captureFunction · 0.85

Calls 7

git_commandFunction · 0.85
execute_rawFunction · 0.85
command_failureFunction · 0.85
successMethod · 0.80
output_textFunction · 0.70
pushMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected