Commit 0a710912 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Limit cdUp to root

Task-number: QTCREATORBUG-10860

Change-Id: I22550b4415e07cac0d78f36595dc7ee781a837c0
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent a3f30b3d
......@@ -230,7 +230,7 @@ QString ClearCasePlugin::getDriveLetterOfPath(const QString &directory)
{
// cdUp until we get just the drive letter
QDir dir(directory);
while (dir.cdUp())
while (!dir.isRoot() && dir.cdUp())
{ }
return dir.path();
......
......@@ -1349,7 +1349,9 @@ bool CvsPlugin::managesDirectory(const QString &directory, QString *topLevel /*
* not have a "CVS" directory. The starting directory must be a managed
* one. Go up and try to find the first unmanaged parent 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)) {
*topLevel = lastDirectory.absolutePath();
break;
......
......@@ -977,7 +977,7 @@ QString GitClient::findRepositoryForDirectory(const QString &dir)
else if (directory.exists(QLatin1String(".git/config")))
return directory.absolutePath();
}
} while (directory.cdUp());
} while (!directory.isRoot() && directory.cdUp());
return QString();
}
......
......@@ -218,7 +218,7 @@ QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Fi
&& dirName.compare(QLatin1String("qt"), Qt::CaseInsensitive)) {
break;
}
} while (dir.cdUp());
} while (!dir.isRoot() && dir.cdUp());
}
return fromPath ?
......
......@@ -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
* parents may be svn:externals. */
QDir parentDir = dir;
while (parentDir.cdUp()) {
while (!parentDir.isRoot() && parentDir.cdUp()) {
if (checkSVNSubDir(parentDir, QLatin1String("wc.db"))) {
if (topLevel)
*topLevel = parentDir.absolutePath();
......@@ -1344,7 +1344,9 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe
if (topLevel) {
QDir lastDirectory = dir;
for (parentDir = lastDirectory; parentDir.cdUp() ; lastDirectory = parentDir) {
for (parentDir = lastDirectory;
!parentDir.isRoot() && parentDir.cdUp();
lastDirectory = parentDir) {
if (!checkSVNSubDir(parentDir)) {
*topLevel = lastDirectory.absolutePath();
break;
......
......@@ -732,7 +732,7 @@ QString VcsBasePlugin::findRepositoryForDirectory(const QString &dirS,
qDebug() << "<VcsBasePlugin::findRepositoryForDirectory> " << absDirPath;
return absDirPath;
}
} while (directory.cdUp());
} while (!directory.isRoot() && directory.cdUp());
if (debugRepositorySearch)
qDebug() << "<VcsBasePlugin::findRepositoryForDirectory bailing out at " << directory.absolutePath();
return QString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment