diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-06-22 15:49:05 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-06-22 19:31:26 +0300 |
commit | c2404728b623588aa89920ae435b48af0fef011e (patch) | |
tree | ba739c37837b71dbc8881cad81204ac2ee6f50e4 /bdep/git.cxx | |
parent | f95f24412ea85149556b34abb91f06e247d6db6d (diff) |
Add branch sub-option for git project vcs in bdep-new
Also fix tests which failed if for the initial branch git-init defaults to
the name other than 'master'.
Diffstat (limited to 'bdep/git.cxx')
-rw-r--r-- | bdep/git.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/bdep/git.cxx b/bdep/git.cxx index cc697b3..f9bdc04 100644 --- a/bdep/git.cxx +++ b/bdep/git.cxx @@ -24,10 +24,8 @@ namespace bdep static optional<semantic_version> bun_git_ver; #endif - // Check that git is at least of the specified minimum supported version. - // - void - git_check_version (const semantic_version& min_ver, bool system) + bool + git_try_check_version (const semantic_version& min_ver, bool system) { // Query and cache git version on the first call. // @@ -50,9 +48,24 @@ namespace bdep // Note that we don't expect the min_ver to contain the build component, // that doesn't matter functionality-wise for git. // - if (*gv < min_ver) + return *gv >= min_ver; + } + + // As above but issue diagnostics and fail if git is older than the + // specified minimum supported version. + // + void + git_check_version (const semantic_version& min_ver, bool system) + { + if (!git_try_check_version (min_ver, system)) + { + optional<semantic_version>& gv (system ? sys_git_ver : bun_git_ver); + + assert (gv); // Must have been cached by git_try_check_version(). + fail << "unsupported git version " << *gv << info << "minimum supported version is " << min_ver << endf; + } } // Return git process path and the --exec-path option, if it is required for |