aboutsummaryrefslogtreecommitdiff
path: root/bdep/git.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-11 22:25:39 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-11 22:25:39 +0300
commit7a6c15e8ff135fc6b22b09038454d007da9642f4 (patch)
treef7a4454c2e1cd0c528e92c5b0f9017263d48cba9 /bdep/git.cxx
parent4a9790b9d8262f44bd42bfe9af0860873725b32b (diff)
Make get-related functions to take minimum supported version as an argument
Diffstat (limited to 'bdep/git.cxx')
-rw-r--r--bdep/git.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/bdep/git.cxx b/bdep/git.cxx
index c0b48fc..79e6255 100644
--- a/bdep/git.cxx
+++ b/bdep/git.cxx
@@ -5,7 +5,6 @@
#include <bdep/git.hxx>
#include <libbutl/git.mxx>
-#include <libbutl/standard-version.mxx>
#include <bdep/diagnostics.hxx>
@@ -15,8 +14,11 @@ namespace bdep
{
static optional<standard_version> git_ver;
+ // On the first call check that git is at least of the specified minimum
+ // supported version.
+ //
void
- git_check_version ()
+ git_check_version (const standard_version& min_ver)
{
if (!git_ver)
{
@@ -25,14 +27,16 @@ namespace bdep
//
git_ver = standard_version ();
- optional<string> s (git_line (false /* ignore_error */, "--version"));
+ optional<string> s (git_line (min_ver,
+ false /* ignore_error */,
+ "--version"));
if (!s || !(git_ver = git_version (*s)))
fail << "unable to obtain git version";
- if (git_ver->version < 20120000000)
+ if (*git_ver < min_ver)
fail << "unsupported git version " << *git_ver <<
- info << "minimum supported version is 2.12.0" << endf;
+ info << "minimum supported version is " << min_ver << endf;
}
}