Hotfix of stale file contents in 186898

This commit is contained in:
Fangrui Song 2018-01-31 08:42:25 -08:00
parent 3e16055b31
commit 871ae34a1b

View File

@ -285,7 +285,12 @@ std::vector<FileContents> PreloadFileContents(
bool loaded_entry = false; bool loaded_entry = false;
std::vector<FileContents> file_contents; std::vector<FileContents> file_contents;
cache_manager->IterateLoadedCaches([&](IndexFile* index) { cache_manager->IterateLoadedCaches([&](IndexFile* index) {
file_contents.push_back(FileContents(index->path, index->file_contents)); optional<std::string> index_content = ReadContent(index->path);
if (!index_content) {
LOG_S(ERROR) << "Failed to load index content for " << index->path;
return;
}
file_contents.push_back(FileContents(index->path, *index_content));
loaded_entry = loaded_entry || index->path == entry.filename; loaded_entry = loaded_entry || index->path == entry.filename;
}); });
if (!loaded_entry) if (!loaded_entry)