From 8e5f53fd249f08b0be0a7d4eec65f425cfb79eae Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 14 Aug 2018 19:28:54 +0300 Subject: Adapt to git_version() returning semantic_version now --- bdep/git.cxx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'bdep/git.cxx') diff --git a/bdep/git.cxx b/bdep/git.cxx index 79e6255..a5e2be4 100644 --- a/bdep/git.cxx +++ b/bdep/git.cxx @@ -12,32 +12,36 @@ using namespace butl; namespace bdep { - static optional git_ver; + static optional git_ver; - // On the first call check that git is at least of the specified minimum - // supported version. + // Check that git is at least of the specified minimum supported version. // void - git_check_version (const standard_version& min_ver) + git_check_version (const semantic_version& min_ver) { + // Query and cache git version on the first call. + // if (!git_ver) { // Make sure that the getline() function call doesn't end up with an // infinite recursion. // - git_ver = standard_version (); + git_ver = semantic_version (); - optional s (git_line (min_ver, + optional s (git_line (*git_ver, false /* ignore_error */, "--version")); if (!s || !(git_ver = git_version (*s))) fail << "unable to obtain git version"; - - if (*git_ver < min_ver) - fail << "unsupported git version " << *git_ver << - info << "minimum supported version is " << min_ver << endf; } + + // Note that we don't expect the min_ver to contain the build component, + // that doesn't matter functionality-wise for git. + // + if (*git_ver < min_ver) + fail << "unsupported git version " << *git_ver << + info << "minimum supported version is " << min_ver << endf; } optional -- cgit v1.1