use crate::shadow_git::shadow_request;
use crate::transaction_git::{GitContext, GitFailure, GitOutput, GitRequest, run_git_checked};
use std::ffi::OsString;
use std::path::{Path, PathBuf};
pub fn run_shadow_checked(
context: &GitContext,
shadow: &Path,
cwd: &Path,
arguments: &[&str],
input: Option<&[u8]>,
index: Option<&Path>,
environment: &[(OsString, OsString)],
) -> Result<GitOutput, GitFailure> {
let mut request: GitRequest = shadow_request(shadow, cwd, arguments);
request.input = input.map(|bytes| { return bytes.to_vec(); });
request.index = index.map(|path| { return path.to_path_buf(); });
request.environment = environment.to_vec();
return run_git_checked(context, &request);
}
pub fn replay_base_index(directory: &Path, replay: u64) -> PathBuf {
return directory.join(format!("replay-base-{replay}.index"));
}
#[cfg(test)]
#[path = "replay_shadow_tests.rs"]
mod tests;