mod batching;
mod check_parsing;
mod diff;
mod execution;
mod expr_env;
mod filtering;
mod job_builder;
mod output;
mod progress;
mod runner;
mod shell;
mod types;
pub use expr_env::{EXPR_CTX, EXPR_ENV};
pub use shell::ShellType;
pub use types::{OutputSummary, Pattern, RunType, Script, Step};
#[allow(unused_imports)]
pub use filtering::{is_binary_file, is_symlink_file};
pub(crate) fn strip_orig_suffix(diff: &str) -> String {
let mut result: Vec<String> = Vec::new();
let mut lines = diff.lines().peekable();
while let Some(line) = lines.next() {
if let Some(after_prefix) = line.strip_prefix("--- ")
&& let Some(next) = lines.peek()
&& next.starts_with("+++ ")
&& !next.contains(".orig")
{
let (path, rest) = after_prefix.split_once('\t').unwrap_or((after_prefix, ""));
if let Some(stripped) = path.strip_suffix(".orig") {
if rest.is_empty() {
result.push(format!("--- {stripped}"));
} else {
result.push(format!("--- {stripped}\t{rest}"));
}
continue;
}
}
result.push(line.to_string());
}
result.join("\n") + "\n"
}