VcsManager: Prevent parents caching when VCS not found

Editing a file inside .git directory is intentionally not detected as
managed by Git. This causes cache override for the real toplevel with
a null version control

Change-Id: I8a333c38fb160e3dba4f0ee4677b68c4c619ac6d
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-03-11 22:02:29 +02:00
committed by Orgad Shaneh
parent e0b2d9e233
commit 29f8d15332

View File

@@ -145,8 +145,12 @@ public:
QString tmpDir = dir; QString tmpDir = dir;
const QChar slash = QLatin1Char('/'); const QChar slash = QLatin1Char('/');
while (tmpDir.count() >= topLevel.count() && tmpDir.count() > 0) { while (tmpDir.count() >= topLevel.count() && !tmpDir.isEmpty()) {
m_cachedMatches.insert(tmpDir, newInfo); m_cachedMatches.insert(tmpDir, newInfo);
// if no vc was found, this might mean we're inside a repo internal directory (.git)
// Cache only input directory, not parents
if (!vc)
break;
const int slashPos = tmpDir.lastIndexOf(slash); const int slashPos = tmpDir.lastIndexOf(slash);
if (slashPos >= 0) if (slashPos >= 0)
tmpDir.truncate(slashPos); tmpDir.truncate(slashPos);