From 4f2d4022dca65da2a6f03e1f27df13deeaab360a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 6 Aug 2018 22:15:05 +0300 Subject: Add git version check (2.12 is minimum supported) --- bdep/git.hxx | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'bdep/git.hxx') diff --git a/bdep/git.hxx b/bdep/git.hxx index 1552670..ca49622 100644 --- a/bdep/git.hxx +++ b/bdep/git.hxx @@ -5,39 +5,49 @@ #ifndef BDEP_GIT_HXX #define BDEP_GIT_HXX +#include + #include #include namespace bdep { - // Return true if the specified directory is a git repository root (contains - // the .git filesystem entry). - // - bool - git (const dir_path&); + using butl::git_repository; - template - inline void - run_git (const dir_path& repo, A&&... args); + template + process + start_git (I&& in, O&& out, E&& err, A&&... args); template - inline process - start_git (I&& in, O&& out, E&& err, const dir_path& repo, A&&... args); + process + start_git (const dir_path& repo, I&& in, O&& out, E&& err, A&&... args); + + void + finish_git (process& pr, bool io_read = false); + + template + void + run_git (const dir_path& repo, A&&... args); // Return the first line of the git output. If ignore_error is true, then // suppress stderr, ignore (normal) error exit status, and return nullopt. // template optional + git_line (bool ignore_error, A&&... args); + + template + optional git_line (const dir_path& repo, bool ignore_error, A&&... args); // Similar to the above but takes the already started git process with a // redirected output pipe. // optional - git_line (process&& pr, fdpipe&& pipe, bool ignore_error = false); + git_line (process&& pr, fdpipe&& pipe, bool ignore_error); } #include +#include #endif // BDEP_GIT_HXX -- cgit v1.1