diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-08-14 19:28:54 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-08-14 19:28:54 +0300 |
commit | 8e5f53fd249f08b0be0a7d4eec65f425cfb79eae (patch) | |
tree | 247b5321b3fda46c390525fab1cc194e64c20ddb /bdep/git.cxx | |
parent | fc9dbf81953ebe3b0757638671eb31787f4f387d (diff) |
Adapt to git_version() returning semantic_version now
Diffstat (limited to 'bdep/git.cxx')
-rw-r--r-- | bdep/git.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
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<standard_version> git_ver; + static optional<semantic_version> 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<string> s (git_line (min_ver, + optional<string> 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<string> |