From 07ddb9f0e2e699a7412d711cfd9a603a92870756 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Wed, 17 Jun 2009 16:26:54 +0200
Subject: [PATCH] Fixes git log, git blame and all the others resetting current
 project

I'm not 100% positive that this is the best fix. Though i can't come up
with a better one for the moment.

Task-Nr: 256251
---
 src/plugins/projectexplorer/projectexplorer.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 59407acd7c6..bbab5eca3bf 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1000,6 +1000,11 @@ void ProjectExplorerPlugin::setCurrentFile(Project *project, const QString &file
 void ProjectExplorerPlugin::setCurrentFile(const QString &filePath)
 {
     Project *project = m_session->projectForFile(filePath);
+    // If the file is not in any project, stay with the current project
+    // e.g. on opening a git diff buffer, git log buffer, we don't change the project
+    // I'm not 100% sure this is correct
+    if (!project)
+        project = m_currentProject;
     setCurrent(project, filePath, 0);
 }
 
-- 
GitLab