From 7ec963664e64a1e776c521c8e39391c81de9067d Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Thu, 25 Apr 2024 15:02:19 +0200 Subject: [PATCH] git blame: Do not try to blame buffer if it has no file (#10985) Release Notes: - Fixed error messages being logged due to inline git blame not working on an empty buffer that hasn't been saved yet. --- crates/editor/src/editor.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index a2fc4d67cf..9b2cfdba2b 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -8982,6 +8982,10 @@ impl Editor { return; }; + if buffer.read(cx).file().is_none() { + return; + } + let project = project.clone(); let blame = cx.new_model(|cx| GitBlame::new(buffer, project, user_triggered, cx)); self.blame_subscription = Some(cx.observe(&blame, |_, _, cx| cx.notify()));