From a09778b4a53387400f7083ec0423d7e31a08a31a Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Wed, 1 May 2024 15:52:29 +0200 Subject: [PATCH] [portsdiff] Optimize for identical commits --- src/vcpkg/commands.portsdiff.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vcpkg/commands.portsdiff.cpp b/src/vcpkg/commands.portsdiff.cpp index def776f9dd..f81a433184 100644 --- a/src/vcpkg/commands.portsdiff.cpp +++ b/src/vcpkg/commands.portsdiff.cpp @@ -172,6 +172,12 @@ namespace vcpkg const StringView git_commit_id_for_current_snapshot = parsed.command_arguments.size() < 2 ? StringLiteral{"HEAD"} : StringView{parsed.command_arguments[1]}; + if (git_commit_id_for_previous_snapshot == git_commit_id_for_current_snapshot) + { + msg::println(msgPortsNoDiff); + Checks::exit_success(VCPKG_LINE_INFO); + } + const auto portsdiff = find_portsdiff(paths, git_commit_id_for_previous_snapshot, git_commit_id_for_current_snapshot); const auto& added_ports = portsdiff.added_ports;