Git: Fix reading of gitfile

* QFile ctor does not open the file for read.
* Replace readLine with read(8) to avoid needless read.

This amends commit e9eeaf33b3.

Change-Id: I33c230497ad431091d7d6b271846f5af661b4e0d
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2018-10-01 21:56:17 +03:00
committed by Orgad Shaneh
parent d585b85550
commit 681297ad7e

View File

@@ -82,7 +82,10 @@ bool GitVersionControl::isVcsFileOrDirectory(const Utils::FileName &fileName) co
return false;
if (fileName.toFileInfo().isDir())
return true;
return QFile(fileName.toString()).readLine().startsWith("gitdir: ");
QFile file(fileName.toString());
if (!file.open(QFile::ReadOnly))
return false;
return file.read(8) == "gitdir: ";
}
bool GitVersionControl::isConfigured() const