From c0d783502204989be8710957380a7161652415ee Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Fri, 1 Dec 2023 13:03:31 +0100 Subject: [PATCH] Git: Stop Instant Blame when git returns empty blame data That can happen for example, when having a file with active Instant Blame open and choosing "Save As" to save a copy of that file in a folder not under version control. Also fix the related case, when the file is saved in the same folder, but is not under version control yet. In this case, let's remove the blame mark, otherwise it will stay forever as we only stopped the cursor connection. Fixes: QTCREATORBUG-29991 Change-Id: I6ffed869c18334ba87dbcded409d31ead21f4b25 Reviewed-by: Orgad Shaneh Reviewed-by: --- src/plugins/git/gitplugin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 3f8c55b18d4..24441a0a264 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1592,10 +1592,14 @@ void GitPluginPrivate::instantBlame() const auto commandHandler = [this, filePath, line](const CommandResult &result) { if (result.result() == ProcessResult::FinishedWithError && result.cleanedStdErr().contains("no such path")) { - disconnect(m_blameCursorPosConn); + stopInstantBlame(); return; } const QString output = result.cleanedStdOut(); + if (output.isEmpty()) { + stopInstantBlame(); + return; + } const CommitInfo info = parseBlameOutput(output.split('\n'), filePath, m_author); m_blameMark.reset(new BlameMark(filePath, line, info)); };