forked from qt-creator/qt-creator
VCS: Prevent soft assertion for non-existent directories
Blame in a renamed directory then blaming some revision with the previous name triggers an assertion Change-Id: If89a268a776df1c6e0061fd5828492b0200237b4 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
4e4fdb4db0
commit
1cf1159f41
@@ -271,14 +271,18 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
|||||||
|
|
||||||
// Register Vcs(s) with the cache
|
// Register Vcs(s) with the cache
|
||||||
QString tmpDir = QFileInfo(directory).canonicalFilePath();
|
QString tmpDir = QFileInfo(directory).canonicalFilePath();
|
||||||
const QChar slash = QLatin1Char('/');
|
// directory might refer to a historical directory which doesn't exist.
|
||||||
const StringVersionControlPairs::const_iterator cend = allThatCanManage.constEnd();
|
// In this case, don't cache it.
|
||||||
for (StringVersionControlPairs::const_iterator i = allThatCanManage.constBegin(); i != cend; ++i) {
|
if (!tmpDir.isEmpty()) {
|
||||||
d->cache(i->second, i->first, tmpDir);
|
const QChar slash = QLatin1Char('/');
|
||||||
tmpDir = i->first;
|
const StringVersionControlPairs::const_iterator cend = allThatCanManage.constEnd();
|
||||||
const int slashPos = tmpDir.lastIndexOf(slash);
|
for (StringVersionControlPairs::const_iterator i = allThatCanManage.constBegin(); i != cend; ++i) {
|
||||||
if (slashPos >= 0)
|
d->cache(i->second, i->first, tmpDir);
|
||||||
tmpDir.truncate(slashPos);
|
tmpDir = i->first;
|
||||||
|
const int slashPos = tmpDir.lastIndexOf(slash);
|
||||||
|
if (slashPos >= 0)
|
||||||
|
tmpDir.truncate(slashPos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return result
|
// return result
|
||||||
|
|||||||
Reference in New Issue
Block a user