diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 39a0d2b200a..6b7bf664bc1 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -819,14 +819,12 @@ void GitClient::diff(const QString &workingDirectory, if (unstagedFileNames.empty() && stagedFileNames.empty()) { // local repository diff handler->diffRepository(); + } else if (!stagedFileNames.empty()) { + // diff of selected files only with --cached option, used in commit editor + handler->diffFiles(stagedFileNames, unstagedFileNames); } else { - if (!stagedFileNames.empty()) { - // diff of selected files only with --cached option, used in commit editor - handler->diffFiles(stagedFileNames, unstagedFileNames); - } else if (!unstagedFileNames.empty()) { - // current project diff - handler->diffProjects(unstagedFileNames); - } + // current project diff + handler->diffProjects(unstagedFileNames); } } else { const QString binary = settings()->stringValue(GitSettings::binaryPathKey);