refactor(cli): sweep 15 bail("git X") sites to use git_run with context labels

This commit is contained in:
adlee-was-taken
2026-05-08 22:10:25 -04:00
parent f3cdbed7b6
commit 97c8f994e1
6 changed files with 50 additions and 46 deletions

View File

@@ -32,10 +32,12 @@ pub(crate) fn commit_paths(
) -> Result<()> {
let mut args: Vec<&str> = vec!["add"];
args.extend_from_slice(paths);
let status = crate::helpers::git_command(vault.root(), &args).status()?;
if !status.success() { anyhow::bail!("git add failed"); }
let status = crate::helpers::git_command(vault.root(), &["commit", "-m", message]).status()?;
if !status.success() { anyhow::bail!("git commit failed"); }
crate::helpers::git_run(vault.root(), &args, &format!("commit \"{message}\": git add"))?;
crate::helpers::git_run(
vault.root(),
&["commit", "-m", message],
&format!("commit \"{message}\": git commit"),
)?;
Ok(())
}