mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
added git_shallow
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user