added git_shallow

This commit is contained in:
isanae
2020-05-21 05:29:40 -04:00
parent 5da3c175b8
commit a2f9e2f6b8
5 changed files with 26 additions and 4 deletions
+4 -1
View File
@@ -13,7 +13,7 @@ mo_branch = master
no_pull = false
ignore_ts = false
revert_ts = false
git_shallow = true
git_username =
git_email =
@@ -23,6 +23,9 @@ remote_key =
remote_no_push_upstream = false
remote_push_default_origin = false
[super:options]
git_shallow = false
[tools]
sevenz = 7z.exe
jom = jom.exe
+6
View File
@@ -230,6 +230,11 @@ bool task_conf_holder::ignore_ts()const
return conf::bool_option_by_name(task_.names(), "ignore_ts");
}
bool task_conf_holder::git_shallow() const
{
return conf::bool_option_by_name(task_.names(), "git_shallow");
}
std::string task_conf_holder::git_user() const
{
return conf::option_by_name(task_.names(), "git_username");
@@ -280,6 +285,7 @@ git task_conf_holder::make_git(git::ops o) const
g.ignore_ts_on_clone(ignore_ts());
g.revert_ts_on_pull(revert_ts());
g.credentials(git_user(), git_email());
g.shallow(git_shallow());
if (set_origin_remote())
{
+1
View File
@@ -39,6 +39,7 @@ public:
bool no_pull() const;
bool revert_ts() const;
bool ignore_ts()const;
bool git_shallow() const;
std::string git_user() const;
std::string git_email() const;
bool set_origin_remote() const;
+13 -3
View File
@@ -6,7 +6,7 @@ namespace mob
{
git::git(ops o)
: basic_process_runner("git"), op_(o), ignore_ts_(false)
: basic_process_runner("git"), op_(o)
{
}
@@ -139,6 +139,12 @@ git& git::revert_ts_on_pull(bool b)
return *this;
}
git& git::shallow(bool b)
{
shallow_ = b;
return *this;
}
void git::do_run()
{
if (url_.empty() || root_.empty())
@@ -232,8 +238,12 @@ bool git::do_clone()
process_ = make_process()
.stderr_level(context::level::trace)
.arg("clone")
.arg("--recurse-submodules")
.arg("--depth", "1")
.arg("--recurse-submodules");
if (shallow_)
process_.arg("--depth", "1");
process_
.arg("--branch", branch_)
.arg("--quiet", process::log_quiet)
.arg("-c", "advice.detachedHead=false", process::log_quiet)
+2
View File
@@ -180,6 +180,7 @@ public:
const std::string& submodule_name() const;
git& ignore_ts_on_clone(bool b);
git& revert_ts_on_pull(bool b);
git& shallow(bool b);
git& remote(
std::string org, std::string key,
@@ -202,6 +203,7 @@ private:
bool push_default_origin_ = false;
bool ignore_ts_ = false;
bool revert_ts_ = false;
bool shallow_ = false;
process make_process();