git: Do not log error if repository has no commits (#11163)

Thorsten Ball and Bennet created

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 <bennetbo@gmx.de>

Change summary

crates/git/src/commit.rs | 4 ++++
1 file changed, 4 insertions(+)

Detailed changes

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<HashMap<Oid, String>> {
+    if shas.is_empty() {
+        return Ok(HashMap::default());
+    }
+
     const MARKER: &'static str = "<MARKER>";
 
     let mut command = Command::new("git");