From a468e4a6a1dc69e32bc492397f5d15b037d1be1a Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Sat, 17 Feb 2024 23:34:25 +0000 Subject: [PATCH 01/12] Move json data --- src/vcpkg/commands.add-version.cpp | 27 ++++++++--------- src/vcpkg/commands.set-installed.cpp | 45 ++++++++++++++-------------- src/vcpkg/metrics.cpp | 4 +-- 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/vcpkg/commands.add-version.cpp b/src/vcpkg/commands.add-version.cpp index a68b257264..ebf8f77f41 100644 --- a/src/vcpkg/commands.add-version.cpp +++ b/src/vcpkg/commands.add-version.cpp @@ -94,15 +94,15 @@ namespace Json::Object serialize_baseline(const std::map>& baseline) { Json::Object port_entries_obj; - for (auto&& kv_pair : baseline) + for (auto&& [key, value] : baseline) { Json::Object baseline_version_obj; - insert_version_to_json_object(baseline_version_obj, kv_pair.second, BASELINE); - port_entries_obj.insert(kv_pair.first, baseline_version_obj); + insert_version_to_json_object(baseline_version_obj, value, BASELINE); + port_entries_obj.insert(key, std::move(baseline_version_obj)); } Json::Object baseline_obj; - baseline_obj.insert("default", port_entries_obj); + baseline_obj.insert("default", std::move(port_entries_obj)); return baseline_obj; } @@ -118,7 +118,7 @@ namespace } Json::Object output_object; - output_object.insert("versions", versions_array); + output_object.insert("versions", std::move(versions_array)); return output_object; } @@ -142,15 +142,13 @@ namespace fs.rename(new_path, output_path, VCPKG_LINE_INFO); } - UpdateResult update_baseline_version(const VcpkgPaths& paths, + UpdateResult update_baseline_version(const Filesystem& fs, const std::string& port_name, const Version& version, const Path& baseline_path, std::map>& baseline_map, bool print_success) { - auto& fs = paths.get_filesystem(); - auto it = baseline_map.find(port_name); if (it != baseline_map.end()) { @@ -321,7 +319,7 @@ namespace namespace vcpkg { - constexpr CommandMetadata CommandAddVersionMetadata{ + static constexpr CommandMetadata CommandAddVersionMetadata{ "x-add-version", msgCmdAddVersionSynopsis, {msgCmdAddVersionExample1, "vcpkg x-add-version curl --overwrite-version"}, @@ -376,11 +374,10 @@ namespace vcpkg auto baseline_map = [&]() -> std::map> { if (!fs.exists(baseline_path, IgnoreErrors{})) { - std::map> ret; - return ret; + return std::map> {}; } auto maybe_baseline_map = vcpkg::get_builtin_baseline(paths); - return maybe_baseline_map.value_or_exit(VCPKG_LINE_INFO); + return std::move(maybe_baseline_map).value_or_exit(VCPKG_LINE_INFO); }(); // Get tree-ish from local repository state. @@ -393,7 +390,7 @@ namespace vcpkg auto maybe_changes = git_ports_with_uncommitted_changes(git_config); if (auto changes = maybe_changes.get()) { - changed_ports.insert(changes->begin(), changes->end()); + changed_ports = std::move(*changes); } else if (verbose) { @@ -462,7 +459,7 @@ namespace vcpkg } const auto& git_tree = git_tree_it->second; - char prefix[] = {port_name[0], '-', '\0'}; + const char prefix[] = {port_name[0], '-', '\0'}; auto port_versions_path = paths.builtin_registry_versions / prefix / Strings::concat(port_name, ".json"); auto updated_versions_file = update_version_db_file(paths, port_name, @@ -474,7 +471,7 @@ namespace vcpkg add_all, skip_version_format_check); auto updated_baseline_file = update_baseline_version( - paths, port_name, schemed_version.version, baseline_path, baseline_map, verbose); + paths.get_filesystem(), port_name, schemed_version.version, baseline_path, baseline_map, verbose); if (verbose && updated_versions_file == UpdateResult::NotUpdated && updated_baseline_file == UpdateResult::NotUpdated) { diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index a018b48f85..a272402b23 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -59,23 +59,24 @@ namespace vcpkg if (args.github_ref.has_value() && args.github_sha.has_value() && args.github_job.has_value() && args.github_workflow.has_value() && args.github_run_id.has_value()) { - Json::Object detector; - detector.insert("name", Json::Value::string("vcpkg")); - detector.insert("url", Json::Value::string("https://github.com/microsoft/vcpkg")); - detector.insert("version", Json::Value::string("1.0.0")); - - Json::Object job; - job.insert("id", Json::Value::string(*args.github_run_id.get())); - job.insert("correlator", Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); - Json::Object snapshot; - snapshot.insert("job", job); - snapshot.insert("version", Json::Value::integer(0)); - snapshot.insert("sha", Json::Value::string(*args.github_sha.get())); - snapshot.insert("ref", Json::Value::string(*args.github_ref.get())); - snapshot.insert("scanned", Json::Value::string(CTime::now_string())); - snapshot.insert("detector", detector); - + { + Json::Object detector; + detector.insert("name", Json::Value::string("vcpkg")); + detector.insert("url", Json::Value::string("https://github.com/microsoft/vcpkg")); + detector.insert("version", Json::Value::string("1.0.0")); + + Json::Object job; + job.insert("id", Json::Value::string(*args.github_run_id.get())); + job.insert("correlator", Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); + + snapshot.insert("job", std::move(job)); + snapshot.insert("version", Json::Value::integer(0)); + snapshot.insert("sha", Json::Value::string(*args.github_sha.get())); + snapshot.insert("ref", Json::Value::string(*args.github_ref.get())); + snapshot.insert("scanned", Json::Value::string(CTime::now_string())); + snapshot.insert("detector", std::move(detector)); + } Json::Object manifest; manifest.insert("name", "vcpkg.json"); @@ -90,7 +91,7 @@ namespace vcpkg auto version = scf.to_version().to_string(); auto s = action.spec.to_string(); auto pkg_url = Strings::concat("pkg:github/vcpkg/", s, "@", version); - map.insert({s, pkg_url}); + map.emplace(std::move(s), std::move(pkg_url)); } Json::Object resolved; @@ -111,14 +112,14 @@ namespace vcpkg deps_list.push_back(dep_pkg_url); } } - resolved_item.insert("dependencies", deps_list); - resolved.insert(pkg_url, resolved_item); + resolved_item.insert("dependencies", std::move(deps_list)); + resolved.insert(pkg_url, std::move(resolved_item)); } } - manifest.insert("resolved", resolved); + manifest.insert("resolved", std::move(resolved)); Json::Object manifests; - manifests.insert("vcpkg.json", manifest); - snapshot.insert("manifests", manifests); + manifests.insert("vcpkg.json", std::move(manifest)); + snapshot.insert("manifests", std::move(manifests)); Debug::print(Json::stringify(snapshot)); return snapshot; diff --git a/src/vcpkg/metrics.cpp b/src/vcpkg/metrics.cpp index 8f2b4453e9..72a04a9d46 100644 --- a/src/vcpkg/metrics.cpp +++ b/src/vcpkg/metrics.cpp @@ -443,8 +443,8 @@ namespace vcpkg buildtime_times.push_back(Json::Value::number(buildtime.second)); } - properties.insert("buildnames_1", buildtime_names); - properties.insert("buildtimes", buildtime_times); + properties.insert("buildnames_1", std::move(buildtime_names)); + properties.insert("buildtimes", std::move(buildtime_times)); } Json::Object& measurements = base_data.insert("measurements", Json::Object()); From 653ebff2c99038aacf472b441e7454ace8fd9864 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Sat, 17 Feb 2024 23:38:26 +0000 Subject: [PATCH 02/12] Fic build --- src/vcpkg/commands.add-version.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/commands.add-version.cpp b/src/vcpkg/commands.add-version.cpp index ebf8f77f41..c1a0af96c4 100644 --- a/src/vcpkg/commands.add-version.cpp +++ b/src/vcpkg/commands.add-version.cpp @@ -319,7 +319,7 @@ namespace namespace vcpkg { - static constexpr CommandMetadata CommandAddVersionMetadata{ + constexpr CommandMetadata CommandAddVersionMetadata{ "x-add-version", msgCmdAddVersionSynopsis, {msgCmdAddVersionExample1, "vcpkg x-add-version curl --overwrite-version"}, From 406390ef46dfca104483095888ca73f40f4afcb9 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Sat, 17 Feb 2024 23:44:02 +0000 Subject: [PATCH 03/12] format --- src/vcpkg/commands.add-version.cpp | 2 +- src/vcpkg/commands.set-installed.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vcpkg/commands.add-version.cpp b/src/vcpkg/commands.add-version.cpp index c1a0af96c4..3c506db268 100644 --- a/src/vcpkg/commands.add-version.cpp +++ b/src/vcpkg/commands.add-version.cpp @@ -374,7 +374,7 @@ namespace vcpkg auto baseline_map = [&]() -> std::map> { if (!fs.exists(baseline_path, IgnoreErrors{})) { - return std::map> {}; + return std::map>{}; } auto maybe_baseline_map = vcpkg::get_builtin_baseline(paths); return std::move(maybe_baseline_map).value_or_exit(VCPKG_LINE_INFO); diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index a272402b23..c926ce7b8b 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -68,7 +68,8 @@ namespace vcpkg Json::Object job; job.insert("id", Json::Value::string(*args.github_run_id.get())); - job.insert("correlator", Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); + job.insert("correlator", + Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); snapshot.insert("job", std::move(job)); snapshot.insert("version", Json::Value::integer(0)); From 80e6b0297d84ee4734d0738af5f48896a7ed318a Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:00:22 +0000 Subject: [PATCH 04/12] Avoid double find --- src/vcpkg/commands.set-installed.cpp | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index 9945d9586e..3e5a017830 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -99,23 +99,27 @@ namespace vcpkg for (auto&& action : action_plan.install_actions) { Json::Object resolved_item; - if (map.find(action.spec.to_string()) != map.end()) + const auto pkg_it = map.find(action.spec.to_string()); + if (pkg_it != map.end()) { - auto pkg_url = map.at(action.spec.to_string()); - resolved_item.insert("package_url", pkg_url); - resolved_item.insert("relationship", Json::Value::string("direct")); - Json::Array deps_list; - for (auto&& dep : action.package_dependencies) + continue; + } + + const auto& pkg_url = pkg_it->second; + resolved_item.insert("package_url", pkg_url); + resolved_item.insert("relationship", Json::Value::string("direct")); + Json::Array deps_list; + + for (auto&& dep : action.package_dependencies) + { + const auto dep_pkg_it = map.find(dep.to_string()); + if (dep_pkg_it != map.end()) { - if (map.find(dep.to_string()) != map.end()) - { - auto dep_pkg_url = map.at(dep.to_string()); - deps_list.push_back(dep_pkg_url); - } + deps_list.push_back(dep_pkg_it->second); } - resolved_item.insert("dependencies", std::move(deps_list)); - resolved.insert(pkg_url, std::move(resolved_item)); } + resolved_item.insert("dependencies", std::move(deps_list)); + resolved.insert(pkg_url, std::move(resolved_item)); } manifest.insert("resolved", std::move(resolved)); Json::Object manifests; From 021bdf238c4bd557c86ce1d99b21810907e12d84 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:04:06 +0000 Subject: [PATCH 05/12] Invert condition --- src/vcpkg/commands.set-installed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index 3e5a017830..863c81b93d 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -100,7 +100,7 @@ namespace vcpkg { Json::Object resolved_item; const auto pkg_it = map.find(action.spec.to_string()); - if (pkg_it != map.end()) + if (pkg_it == map.end()) { continue; } From f3b37b99d2362e424dbac9bb7d37be5b8f4ca482 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:05:36 +0000 Subject: [PATCH 06/12] format --- src/vcpkg/commands.set-installed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index 863c81b93d..6464da09f3 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -104,7 +104,7 @@ namespace vcpkg { continue; } - + const auto& pkg_url = pkg_it->second; resolved_item.insert("package_url", pkg_url); resolved_item.insert("relationship", Json::Value::string("direct")); From d94589724495785883cee8bec858e559638ce3e5 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Wed, 21 Feb 2024 08:58:57 +0000 Subject: [PATCH 07/12] defend against re-using moved-from variables --- src/vcpkg/commands.set-installed.cpp | 88 +++++++++++++++------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index 6464da09f3..9ce5922f3f 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -56,45 +56,51 @@ namespace vcpkg Optional create_dependency_graph_snapshot(const VcpkgCmdArguments& args, const ActionPlan& action_plan) { - if (args.github_ref.has_value() && args.github_sha.has_value() && args.github_job.has_value() && - args.github_workflow.has_value() && args.github_run_id.has_value()) + if (!args.github_ref.has_value() || !args.github_sha.has_value() || !args.github_job.has_value() || + !args.github_workflow.has_value() || !args.github_run_id.has_value()) { - Json::Object snapshot; - { - Json::Object detector; - detector.insert("name", Json::Value::string("vcpkg")); - detector.insert("url", Json::Value::string("https://github.com/microsoft/vcpkg")); - detector.insert("version", Json::Value::string("1.0.0")); - - Json::Object job; - job.insert("id", Json::Value::string(*args.github_run_id.get())); - job.insert("correlator", - Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); - - snapshot.insert("job", std::move(job)); - snapshot.insert("version", Json::Value::integer(0)); - snapshot.insert("sha", Json::Value::string(*args.github_sha.get())); - snapshot.insert("ref", Json::Value::string(*args.github_ref.get())); - snapshot.insert("scanned", Json::Value::string(CTime::now_string())); - snapshot.insert("detector", std::move(detector)); - } - Json::Object manifest; - manifest.insert("name", "vcpkg.json"); + return nullopt; + } - std::unordered_map map; - for (auto&& action : action_plan.install_actions) + Json::Object snapshot; + { + Json::Object job; + job.insert("id", Json::Value::string(*args.github_run_id.get())); + job.insert("correlator", Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); + snapshot.insert("job", std::move(job)); + } // destroy job + + snapshot.insert("version", Json::Value::integer(0)); + snapshot.insert("sha", Json::Value::string(*args.github_sha.get())); + snapshot.insert("ref", Json::Value::string(*args.github_ref.get())); + snapshot.insert("scanned", Json::Value::string(CTime::now_string())); + + { + Json::Object detector; + detector.insert("name", Json::Value::string("vcpkg")); + detector.insert("url", Json::Value::string("https://github.com/microsoft/vcpkg")); + detector.insert("version", Json::Value::string("1.0.0")); + snapshot.insert("detector", std::move(detector)); + } // destroy detector + + std::unordered_map map; + for (auto&& action : action_plan.install_actions) + { + if (!action.source_control_file_and_location.has_value()) { - if (!action.source_control_file_and_location.has_value()) - { - return nullopt; - } - const auto& scf = *action.source_control_file_and_location.get(); - auto version = scf.to_version().to_string(); - auto s = action.spec.to_string(); - auto pkg_url = Strings::concat("pkg:github/vcpkg/", s, "@", version); - map.emplace(std::move(s), std::move(pkg_url)); + return nullopt; } + const auto& scf = *action.source_control_file_and_location.get(); + auto version = scf.to_version().to_string(); + auto s = action.spec.to_string(); + auto pkg_url = Strings::concat("pkg:github/vcpkg/", s, "@", version); + map.emplace(std::move(s), std::move(pkg_url)); + } + Json::Object manifest; + manifest.insert("name", "vcpkg.json"); + + { Json::Object resolved; for (auto&& action : action_plan.install_actions) { @@ -122,14 +128,14 @@ namespace vcpkg resolved.insert(pkg_url, std::move(resolved_item)); } manifest.insert("resolved", std::move(resolved)); - Json::Object manifests; - manifests.insert("vcpkg.json", std::move(manifest)); - snapshot.insert("manifests", std::move(manifests)); + } // destroy resolved - Debug::print(Json::stringify(snapshot)); - return snapshot; - } - return nullopt; + Json::Object manifests; + manifests.insert("vcpkg.json", std::move(manifest)); + snapshot.insert("manifests", std::move(manifests)); + + Debug::print(Json::stringify(snapshot)); + return snapshot; } std::set adjust_action_plan_to_status_db(ActionPlan& action_plan, const StatusParagraphs& status_db) From d58e443dd5fd2f1011e1e22afc5130a7d420fc41 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Mon, 18 Mar 2024 10:48:20 +0000 Subject: [PATCH 08/12] fix merge --- src/vcpkg/commands.add-version.cpp | 2 +- src/vcpkg/commands.set-installed.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vcpkg/commands.add-version.cpp b/src/vcpkg/commands.add-version.cpp index f6c385389b..40874ad059 100644 --- a/src/vcpkg/commands.add-version.cpp +++ b/src/vcpkg/commands.add-version.cpp @@ -92,7 +92,7 @@ namespace } Json::Object baseline_obj; - baseline_obj.insert("default", std::move(port_entries_obj)); + baseline_obj.insert(JsonIdDefault, std::move(port_entries_obj)); return baseline_obj; } diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index 5923728c79..9378ac4448 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -59,7 +59,8 @@ namespace vcpkg { Json::Object job; job.insert(JsonIdId, Json::Value::string(*args.github_run_id.get())); - job.insert(JsonIdCorrelator, Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); + job.insert(JsonIdCorrelator, + Json::Value::string(*args.github_workflow.get() + "-" + *args.github_job.get())); snapshot.insert(JsonIdJob, std::move(job)); } // destroy job @@ -91,7 +92,7 @@ namespace vcpkg } Json::Object manifest; - manifest.insert("name", "vcpkg.json"); + manifest.insert(JsonIdName, FileVcpkgDotJson); { Json::Object resolved; From e32f53a1738c6cc84a422f274bf1213a0ea65a2c Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Sun, 8 Dec 2024 16:30:58 +0000 Subject: [PATCH 09/12] format --- src/vcpkg/commands.set-installed.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index 56241efd58..e924f89531 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -64,8 +64,7 @@ namespace vcpkg { Json::Object job; job.insert(JsonIdId, Json::Value::string(*github_run_id)); - job.insert(JsonIdCorrelator, - Json::Value::string(fmt::format("{}-{}", *github_workflow, *github_run_id))); + job.insert(JsonIdCorrelator, Json::Value::string(fmt::format("{}-{}", *github_workflow, *github_run_id))); snapshot.insert(JsonIdJob, std::move(job)); } // destroy job @@ -91,7 +90,8 @@ namespace vcpkg return nullopt; } auto spec = action.spec.to_string(); - map.emplace(std::move(spec), fmt::format("pkg:github/vcpkg/{}@{}", spec, scfl->source_control_file->to_version())); + map.emplace(std::move(spec), + fmt::format("pkg:github/vcpkg/{}@{}", spec, scfl->source_control_file->to_version())); } Json::Object manifest; From 679adbd871cfd00a1c925af88fbb2841653f1df8 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Mon, 9 Dec 2024 08:08:54 +0100 Subject: [PATCH 10/12] Update commands.set-installed.cpp --- src/vcpkg/commands.set-installed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index e924f89531..ac57db9279 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -69,7 +69,7 @@ namespace vcpkg } // destroy job snapshot.insert(JsonIdVersion, Json::Value::integer(0)); - snapshot.insert(JsonIdSha, Json::Value::string(*args.github_sha.get())); + snapshot.insert(JsonIdSha, Json::Value::string(*github_sha)); snapshot.insert(JsonIdRef, Json::Value::string(*github_ref)); snapshot.insert(JsonIdScanned, Json::Value::string(CTime::now_string())); From 751004773aa312ea1dc0d0eef7e09a9e9adbac28 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Mon, 9 Dec 2024 08:09:17 +0100 Subject: [PATCH 11/12] fix use after move --- src/vcpkg/commands.set-installed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index ac57db9279..807cb22a92 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -90,7 +90,7 @@ namespace vcpkg return nullopt; } auto spec = action.spec.to_string(); - map.emplace(std::move(spec), + map.emplace(spec, fmt::format("pkg:github/vcpkg/{}@{}", spec, scfl->source_control_file->to_version())); } From 1608295e185223274c2c2a78267569e9b37a1dd6 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Mon, 9 Dec 2024 07:49:48 +0000 Subject: [PATCH 12/12] format --- src/vcpkg/commands.add-version.cpp | 2 -- src/vcpkg/commands.set-installed.cpp | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/vcpkg/commands.add-version.cpp b/src/vcpkg/commands.add-version.cpp index e9db3192ce..8a57a582c4 100644 --- a/src/vcpkg/commands.add-version.cpp +++ b/src/vcpkg/commands.add-version.cpp @@ -544,8 +544,6 @@ namespace vcpkg const auto& git_tree = git_tree_it->second; - const char prefix[] = {port_name[0], '-', '\0'}; - auto port_versions_path = paths.builtin_registry_versions / prefix / Strings::concat(port_name, ".json"); auto updated_versions_file = update_version_db_file(paths, port_name, schemed_version, diff --git a/src/vcpkg/commands.set-installed.cpp b/src/vcpkg/commands.set-installed.cpp index 807cb22a92..a738aa7e54 100644 --- a/src/vcpkg/commands.set-installed.cpp +++ b/src/vcpkg/commands.set-installed.cpp @@ -90,8 +90,7 @@ namespace vcpkg return nullopt; } auto spec = action.spec.to_string(); - map.emplace(spec, - fmt::format("pkg:github/vcpkg/{}@{}", spec, scfl->source_control_file->to_version())); + map.emplace(spec, fmt::format("pkg:github/vcpkg/{}@{}", spec, scfl->source_control_file->to_version())); } Json::Object manifest;