From 9c9d9ba96ab1bb5256ee7217f994e262a389ed9e Mon Sep 17 00:00:00 2001 From: Catherine Gasnier Date: Mon, 9 Sep 2024 05:58:34 -0700 Subject: [PATCH] watchman: when `project-metadata` isn't provided, don't add it to the XDB query Summary: When `project-metadata` isn't provided in the watchman query, instead of adding `AND project_metadata = ""` to the XDB query, just don't add anything. We then need to bubble up the project_metadata from the found saved state to where we construct the manifold path for the saved state. Context: we need this for hack to be able to still get a saved state even when our config has changed. Reviewed By: kmancini Differential Revision: D61018325 fbshipit-source-id: b01b162adeed5a73fd10c2737c9da1115f0b333e --- watchman/telemetry/LogEvent.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/watchman/telemetry/LogEvent.h b/watchman/telemetry/LogEvent.h index 9428d8e54100..7ffaba528623 100644 --- a/watchman/telemetry/LogEvent.h +++ b/watchman/telemetry/LogEvent.h @@ -156,7 +156,7 @@ struct SavedState { std::string project; std::string path; int64_t commit_date = 0; - std::string metadata; + std::optional projectMetadata; std::string properties; bool success = false; @@ -169,8 +169,8 @@ struct SavedState { event.addString("path", path); } event.addInt("commit_date", commit_date); - if (!metadata.empty()) { - event.addString("metadata", metadata); + if (projectMetadata.has_value()) { + event.addString("metadata", projectMetadata.value()); } if (!properties.empty()) { event.addString("properties", properties);