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
|
||||
QString tmpDir = QFileInfo(directory).canonicalFilePath();
|
||||
const QChar slash = QLatin1Char('/');
|
||||
const StringVersionControlPairs::const_iterator cend = allThatCanManage.constEnd();
|
||||
for (StringVersionControlPairs::const_iterator i = allThatCanManage.constBegin(); i != cend; ++i) {
|
||||
d->cache(i->second, i->first, tmpDir);
|
||||
tmpDir = i->first;
|
||||
const int slashPos = tmpDir.lastIndexOf(slash);
|
||||
if (slashPos >= 0)
|
||||
tmpDir.truncate(slashPos);
|
||||
// directory might refer to a historical directory which doesn't exist.
|
||||
// In this case, don't cache it.
|
||||
if (!tmpDir.isEmpty()) {
|
||||
const QChar slash = QLatin1Char('/');
|
||||
const StringVersionControlPairs::const_iterator cend = allThatCanManage.constEnd();
|
||||
for (StringVersionControlPairs::const_iterator i = allThatCanManage.constBegin(); i != cend; ++i) {
|
||||
d->cache(i->second, i->first, tmpDir);
|
||||
tmpDir = i->first;
|
||||
const int slashPos = tmpDir.lastIndexOf(slash);
|
||||
if (slashPos >= 0)
|
||||
tmpDir.truncate(slashPos);
|
||||
}
|
||||
}
|
||||
|
||||
// return result
|
||||
|
||||
Reference in New Issue
Block a user