diff --git a/crates/git/src/commit.rs b/crates/git/src/commit.rs index 50fd0ad2484c77bf227d6138a20481e11ec2e7f9..ece1d76b8ae9c9f40f27178da1ef13fe1a78e659 100644 --- a/crates/git/src/commit.rs +++ b/crates/git/src/commit.rs @@ -8,34 +8,53 @@ pub async fn get_messages(working_directory: &Path, shas: &[Oid]) -> Result>()) +} - let output = util::command::new_smol_command("git") - .current_dir(working_directory) +async fn get_messages_impl(working_directory: &Path, shas: &[Oid]) -> Result> { + const MARKER: &str = ""; + let mut cmd = util::command::new_smol_command("git"); + cmd.current_dir(working_directory) .arg("show") .arg("-s") .arg(format!("--format=%B{}", MARKER)) - .args(shas.iter().map(ToString::to_string)) + .args(shas.iter().map(ToString::to_string)); + let output = cmd .output() .await - .context("starting git blame process")?; - + .with_context(|| format!("starting git blame process: {:?}", cmd))?; anyhow::ensure!( output.status.success(), "'git show' failed with error {:?}", output.status ); - - Ok(shas - .iter() - .cloned() - .zip( - String::from_utf8_lossy(&output.stdout) - .trim() - .split_terminator(MARKER) - .map(|str| str.trim().replace("<", "<").replace(">", ">")), - ) - .collect::>()) + Ok(String::from_utf8_lossy(&output.stdout) + .trim() + .split_terminator(MARKER) + .map(|str| str.trim().replace("<", "<").replace(">", ">")) + .collect::>()) } /// Parse the output of `git diff --name-status -z`