From 5ef75919f09e31c28b75c09e695946b6c4d9c3ee Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Mon, 29 Apr 2024 16:00:29 +0200 Subject: [PATCH] git: Do not log error if repository has no commits (#11163) This is a follow-up to #10685 which started to hide these errors instead of displaying them to the user. But the errors are still noisy and not actionable, so we hide them instead. Release Notes: - Removed error message being logged when `git blame` is run in a repository without commits. Co-authored-by: Bennet --- crates/git/src/commit.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/git/src/commit.rs b/crates/git/src/commit.rs index 5a3aaccae6..f0bc5d8401 100644 --- a/crates/git/src/commit.rs +++ b/crates/git/src/commit.rs @@ -8,6 +8,10 @@ use std::process::Command; use std::os::windows::process::CommandExt; pub fn get_messages(working_directory: &Path, shas: &[Oid]) -> Result> { + if shas.is_empty() { + return Ok(HashMap::default()); + } + const MARKER: &'static str = ""; let mut command = Command::new("git");