diff --git a/src/command_line.cc b/src/command_line.cc index 548c10e4..9a958510 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -896,6 +896,10 @@ std::vector DoParseFile( IndexFile* previous_index = cache_loader->TryLoad(path); if (previous_index) { // If none of the dependencies have changed, skip parsing and just load from cache. + + // Checks if |path| needs to be reparsed. This will modify cached state + // such that calling this function twice with the same path may return true + // the first time but will return false the second. auto file_needs_parse = [&](const std::string& path) { optional modification_timestamp = GetLastModificationTime(path); if (!modification_timestamp) @@ -905,6 +909,7 @@ std::vector DoParseFile( if (!last_cached_modification || modification_timestamp != *last_cached_modification) { file_consumer_shared->Reset(path); + timestamp_manager->UpdateCachedModificationTime(path, *modification_timestamp); return FileParseQuery::NeedsParse; } return FileParseQuery::DoesNotNeedParse; @@ -1284,7 +1289,9 @@ bool QueryDb_ImportMain(Config* config, QueryDatabase* db, ImportManager* import time.Reset(); db->ApplyIndexUpdate(&response->update); - time.ResetAndPrint("Applying index update"); + time.ResetAndPrint("Applying index update for " + StringJoinMap(response->update.files_def_update, [](const QueryFile::DefUpdate& value) { + return value.path; + })); } return did_work; diff --git a/src/utils.h b/src/utils.h index 0375be63..23b722e5 100644 --- a/src/utils.h +++ b/src/utils.h @@ -32,19 +32,27 @@ std::vector SplitString(const std::string& str, const std::string& std::string LowerPathIfCaseInsensitive(const std::string& path); -template -std::string StringJoin(const TValues& values) { + +template +std::string StringJoinMap(const TValues& values, const TMap& map) { std::string result; bool first = true; for (auto& entry : values) { if (!first) result += ", "; first = false; - result += entry; + result += map(entry); } return result; } +template +std::string StringJoin(const TValues& values) { + return StringJoinMap(values, [](const std::string& entry) { + return entry; + }); +} + // Finds all files in the given folder. This is recursive. std::vector GetFilesInFolder(std::string folder, bool recursive, bool add_folder_to_path); void GetFilesInFolder(std::string folder, bool recursive, bool add_folder_to_path, const std::function& handler);