Limit cdUp to root

Task-number: QTCREATORBUG-10860

Change-Id: I22550b4415e07cac0d78f36595dc7ee781a837c0
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Orgad Shaneh
2013-12-03 08:15:44 +02:00
committed by Orgad Shaneh
parent a3f30b3d17
commit 0a71091260
6 changed files with 11 additions and 7 deletions

View File

@@ -230,7 +230,7 @@ QString ClearCasePlugin::getDriveLetterOfPath(const QString &directory)
{ {
// cdUp until we get just the drive letter // cdUp until we get just the drive letter
QDir dir(directory); QDir dir(directory);
while (dir.cdUp()) while (!dir.isRoot() && dir.cdUp())
{ } { }
return dir.path(); return dir.path();

View File

@@ -1349,7 +1349,9 @@ bool CvsPlugin::managesDirectory(const QString &directory, QString *topLevel /*
* not have a "CVS" directory. The starting directory must be a managed * not have a "CVS" directory. The starting directory must be a managed
* one. Go up and try to find the first unmanaged parent dir. */ * one. Go up and try to find the first unmanaged parent dir. */
QDir lastDirectory = dir; QDir lastDirectory = dir;
for (QDir parentDir = lastDirectory; parentDir.cdUp() ; lastDirectory = parentDir) { for (QDir parentDir = lastDirectory;
!parentDir.isRoot() && parentDir.cdUp();
lastDirectory = parentDir) {
if (!checkCVSDirectory(parentDir)) { if (!checkCVSDirectory(parentDir)) {
*topLevel = lastDirectory.absolutePath(); *topLevel = lastDirectory.absolutePath();
break; break;

View File

@@ -977,7 +977,7 @@ QString GitClient::findRepositoryForDirectory(const QString &dir)
else if (directory.exists(QLatin1String(".git/config"))) else if (directory.exists(QLatin1String(".git/config")))
return directory.absolutePath(); return directory.absolutePath();
} }
} while (directory.cdUp()); } while (!directory.isRoot() && directory.cdUp());
return QString(); return QString();
} }

View File

@@ -218,7 +218,7 @@ QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Fi
&& dirName.compare(QLatin1String("qt"), Qt::CaseInsensitive)) { && dirName.compare(QLatin1String("qt"), Qt::CaseInsensitive)) {
break; break;
} }
} while (dir.cdUp()); } while (!dir.isRoot() && dir.cdUp());
} }
return fromPath ? return fromPath ?

View File

@@ -1328,7 +1328,7 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe
* furthest parent containing ".svn/wc.db". Need to check for furthest parent as closer * furthest parent containing ".svn/wc.db". Need to check for furthest parent as closer
* parents may be svn:externals. */ * parents may be svn:externals. */
QDir parentDir = dir; QDir parentDir = dir;
while (parentDir.cdUp()) { while (!parentDir.isRoot() && parentDir.cdUp()) {
if (checkSVNSubDir(parentDir, QLatin1String("wc.db"))) { if (checkSVNSubDir(parentDir, QLatin1String("wc.db"))) {
if (topLevel) if (topLevel)
*topLevel = parentDir.absolutePath(); *topLevel = parentDir.absolutePath();
@@ -1344,7 +1344,9 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe
if (topLevel) { if (topLevel) {
QDir lastDirectory = dir; QDir lastDirectory = dir;
for (parentDir = lastDirectory; parentDir.cdUp() ; lastDirectory = parentDir) { for (parentDir = lastDirectory;
!parentDir.isRoot() && parentDir.cdUp();
lastDirectory = parentDir) {
if (!checkSVNSubDir(parentDir)) { if (!checkSVNSubDir(parentDir)) {
*topLevel = lastDirectory.absolutePath(); *topLevel = lastDirectory.absolutePath();
break; break;

View File

@@ -732,7 +732,7 @@ QString VcsBasePlugin::findRepositoryForDirectory(const QString &dirS,
qDebug() << "<VcsBasePlugin::findRepositoryForDirectory> " << absDirPath; qDebug() << "<VcsBasePlugin::findRepositoryForDirectory> " << absDirPath;
return absDirPath; return absDirPath;
} }
} while (directory.cdUp()); } while (!directory.isRoot() && directory.cdUp());
if (debugRepositorySearch) if (debugRepositorySearch)
qDebug() << "<VcsBasePlugin::findRepositoryForDirectory bailing out at " << directory.absolutePath(); qDebug() << "<VcsBasePlugin::findRepositoryForDirectory bailing out at " << directory.absolutePath();
return QString(); return QString();