diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp
index fe2871ad89e687d3e8966dd4de508fafe13cba4a..23eb2ba73c7c9cc6e24c62951bcdc2658905f848 100644
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
@@ -192,7 +192,7 @@ void GitEditor::setPlainTextDataFiltered(const QByteArray &a)
     }
     case VcsBase::DiffOutput: {
         const QFileInfo fi(source());
-        const QString workingDirectory = fi.absolutePath();
+        const QString workingDirectory = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
         QByteArray precedes, follows;
         if (array.startsWith("commit ")) { // show
             int lastHeaderLine = array.indexOf("\n\n") + 1;