aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authordevel71 <devel71@hotmail.de>2016-11-29 09:36:10 +0100
committerdevel71 <devel71@hotmail.de>2016-11-29 09:36:10 +0100
commit9e6111632100fd2047bc3fc2314c91ea5ffda680 (patch)
treedffe9996bec4d5e32e718e2ee72b0dd780ff9ad8 /toolsrc/src
parent282d979c7eb8a2ebaf7a815f688245450e844b29 (diff)
parent568f742f86c6cb99d56306d34bfc09630e1208da (diff)
downloadvcpkg-9e6111632100fd2047bc3fc2314c91ea5ffda680.tar.gz
vcpkg-9e6111632100fd2047bc3fc2314c91ea5ffda680.zip
Merge branch 'master' of https://github.com/Microsoft/vcpkg into qca
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/BuildInfo.cpp12
-rw-r--r--toolsrc/src/commands_portsdiff.cpp15
2 files changed, 21 insertions, 6 deletions
diff --git a/toolsrc/src/BuildInfo.cpp b/toolsrc/src/BuildInfo.cpp
index 1f802869f..8d46a0dba 100644
--- a/toolsrc/src/BuildInfo.cpp
+++ b/toolsrc/src/BuildInfo.cpp
@@ -14,15 +14,15 @@ namespace vcpkg
return this->m_linkage;
}
- const std::regex& BuildType::crt_regex() const
+ const std::regex BuildType::crt_regex() const
{
- static const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase);
+ const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase);
return r;
}
- const std::string& BuildType::toString() const
+ const std::string BuildType::toString() const
{
- static const std::string s = Strings::format("[%s,%s]", to_string(this->m_config), to_string(this->m_linkage));
+ const std::string s = Strings::format("[%s,%s]", to_string(this->m_config), to_string(this->m_linkage));
return s;
}
@@ -151,9 +151,9 @@ namespace vcpkg
const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT20_DLL = OutdatedDynamicCrt("msvcrt20.dll", R"(msvcrt20\.dll)");;
const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT40_DLL = OutdatedDynamicCrt("msvcrt40.dll", R"(msvcrt40\.dll)");;
- const std::regex& OutdatedDynamicCrt::crt_regex() const
+ const std::regex OutdatedDynamicCrt::crt_regex() const
{
- static const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase);
+ const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase);
return r;
}
diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/commands_portsdiff.cpp
index 3789e3b42..b6b604e54 100644
--- a/toolsrc/src/commands_portsdiff.cpp
+++ b/toolsrc/src/commands_portsdiff.cpp
@@ -8,6 +8,7 @@
#include <set>
#include "Paragraphs.h"
#include "SourceParagraph.h"
+#include "vcpkg_Environment.h"
namespace vcpkg
{
@@ -87,14 +88,28 @@ namespace vcpkg
return names_and_versions;
}
+ static void check_commit_exists(const std::wstring& git_commit_id)
+ {
+ static const std::string VALID_COMMIT_OUTPUT = "commit\n";
+
+ const std::wstring cmd = Strings::wformat(LR"(git cat-file -t %s 2>NUL)", git_commit_id);
+ const System::exit_code_and_output output = System::cmd_execute_and_capture_output(cmd);
+ Checks::check_exit(output.output == VALID_COMMIT_OUTPUT, "Invalid commit id %s", Strings::utf16_to_utf8(git_commit_id));
+ }
+
void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{
static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", create_example_string("portsdiff mybranchname"));
args.check_min_arg_count(1, example.c_str());
args.check_max_arg_count(2, example.c_str());
+
+ Environment::ensure_git_on_path(paths);
const std::wstring git_commit_id_for_previous_snapshot = Strings::utf8_to_utf16(args.command_arguments.at(0));
const std::wstring git_commit_id_for_current_snapshot = args.command_arguments.size() < 2 ? L"HEAD" : Strings::utf8_to_utf16(args.command_arguments.at(1));
+ check_commit_exists(git_commit_id_for_current_snapshot);
+ check_commit_exists(git_commit_id_for_previous_snapshot);
+
const std::map<std::string, std::string> current_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_current_snapshot);
const std::map<std::string, std::string> previous_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_previous_snapshot);