diff --git a/src/plugins/perforce/perforcechecker.cpp b/src/plugins/perforce/perforcechecker.cpp index 92dd5a4cc42..87b02e6ef30 100644 --- a/src/plugins/perforce/perforcechecker.cpp +++ b/src/plugins/perforce/perforcechecker.cpp @@ -175,6 +175,17 @@ static inline QString clientRootFromOutput(const QString &in) return QString(); } +// When p4 port and p4 user is set a preconfigured Root: is given, which doesn't relate with +// the current mapped project. In this case "Client:" has the same value as "Host:", which is an +// invalid case. +static inline bool clientAndHostAreEqual(const QString &in) +{ + QString client = findTerm(in, QLatin1String("Client:")); + QString host = findTerm(in, QLatin1String("Host:")); + + return client == host; +} + void PerforceChecker::parseOutput(const QString &response) { if (!response.contains(QLatin1String("View:")) && !response.contains(QLatin1String("//depot/"))) { @@ -182,6 +193,12 @@ void PerforceChecker::parseOutput(const QString &response) return; } + if (clientAndHostAreEqual(response)) { + // Is an invalid case. But not an error. QtC checks cmake install directories for + // p4 repositories, or the %temp% directory. + return; + } + const QString repositoryRoot = clientRootFromOutput(response); if (repositoryRoot.isEmpty()) { //: Unable to determine root of the p4 client installation