mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
fixed set_remote() trying to get the git file after renaming
fixed basic_process_runner copying the process fixed nulls in log, string was moved don't log process' stderr twice SO with bad format strings can't check path prefix for master, doesn't exist yet
This commit is contained in:
+6
-1
@@ -541,7 +541,12 @@ void init_options(
|
||||
|
||||
for (auto&& ini : inis)
|
||||
{
|
||||
const fs::path prefix_before = conf().path().prefix();
|
||||
fs::path prefix_before;
|
||||
|
||||
// if this is the master ini, the prefix doesn't exist in the config
|
||||
// yet because no inis have been loaded
|
||||
if (!master)
|
||||
prefix_before = conf().path().prefix();
|
||||
|
||||
process_ini(ini, master);
|
||||
|
||||
|
||||
+3
-1
@@ -276,7 +276,9 @@ private:
|
||||
}
|
||||
|
||||
std::wcerr << "bad format string '" << s << "'\n";
|
||||
MOB_ASSERT(false, "bad format string");
|
||||
|
||||
if (IsDebuggerPresent())
|
||||
DebugBreak();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -579,15 +579,14 @@ void process::read_pipe(
|
||||
return;
|
||||
}
|
||||
|
||||
// remember this log line, can be dumped after the process
|
||||
// terminates
|
||||
io_.logs[f.lv].emplace_back(std::move(line));
|
||||
|
||||
// don't log when ignore_output_on_success was specified, the
|
||||
// process must finish before knowing whether to log or not
|
||||
if (!is_set(flags_, ignore_output_on_success))
|
||||
cx_->log_string(f.r, f.lv, f.line);
|
||||
|
||||
// remember this log line, can be dumped after the process
|
||||
// terminates
|
||||
io_.logs[f.lv].emplace_back(std::move(line));
|
||||
});
|
||||
|
||||
break;
|
||||
@@ -701,14 +700,18 @@ void process::on_process_successful()
|
||||
"process exit code is {} (considered success), "
|
||||
"but stderr had something", exec_.code);
|
||||
|
||||
cx_->warning(context::cmd, "process was: {}", make_cmd());
|
||||
cx_->warning(context::cmd, "stderr:");
|
||||
// don't re-log the same stuff
|
||||
if (io_.err.flags != forward_to_log)
|
||||
{
|
||||
cx_->warning(context::cmd, "process was: {}", make_cmd());
|
||||
cx_->warning(context::cmd, "stderr:");
|
||||
|
||||
for (auto&& line : warnings)
|
||||
cx_->warning(context::std_err, " {}", line);
|
||||
for (auto&& line : warnings)
|
||||
cx_->warning(context::std_err, " {}", line);
|
||||
|
||||
for (auto&& line : errors)
|
||||
cx_->warning(context::std_err, " {}", line);
|
||||
for (auto&& line : errors)
|
||||
cx_->warning(context::std_err, " {}", line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-6
@@ -359,7 +359,7 @@ void git::set_remote(
|
||||
if (no_push_upstream)
|
||||
set_remote_push("upstream", "nopushurl");
|
||||
|
||||
add_remote("origin", org, key, push_default_origin);
|
||||
add_remote("origin", org, key, push_default_origin, {}, gf);
|
||||
}
|
||||
|
||||
void git::rename_remote(const std::string& from, const std::string& to)
|
||||
@@ -431,9 +431,11 @@ bool git::has_remote(const std::string& name)
|
||||
void git::add_remote(
|
||||
const std::string& remote_name,
|
||||
const std::string& username, const std::string& key, bool push_default,
|
||||
const std::string& url_pattern)
|
||||
const std::string& url_pattern, const std::string& opt_git_file)
|
||||
{
|
||||
const auto gf = git_file();
|
||||
auto gf = opt_git_file;
|
||||
if (gf.empty())
|
||||
gf = git_file();
|
||||
|
||||
if (!has_remote(remote_name))
|
||||
{
|
||||
@@ -475,6 +477,13 @@ std::string git::current_branch()
|
||||
return trim_copy(p.stdout_string());
|
||||
}
|
||||
|
||||
void git::add_submodule(
|
||||
const std::string& branch, const std::string& submodule,
|
||||
const mob::url& url)
|
||||
{
|
||||
run(details::add_submodule(root_, branch, submodule, url));
|
||||
}
|
||||
|
||||
std::string git::git_file()
|
||||
{
|
||||
auto p = details::git_file(root_);
|
||||
@@ -484,7 +493,7 @@ std::string git::git_file()
|
||||
const auto last_slash = out.find_last_of("/");
|
||||
if (last_slash == std::string::npos)
|
||||
{
|
||||
u8cerr << "bad get-url output '" << out << "'\n";
|
||||
cx().error(context::generic, "bad get-url output '{}'", out);
|
||||
throw bailed();
|
||||
}
|
||||
|
||||
@@ -492,7 +501,7 @@ std::string git::git_file()
|
||||
|
||||
if (s.empty())
|
||||
{
|
||||
u8cerr << "bad get-url output '" << out << "'\n";
|
||||
cx().error(context::generic, "bad get-url output '{}'", out);
|
||||
throw bailed();
|
||||
}
|
||||
|
||||
@@ -731,7 +740,7 @@ const std::string& git_submodule_tool::submodule() const
|
||||
|
||||
void git_submodule_tool::do_run()
|
||||
{
|
||||
execute_and_join(details::add_submodule(root_, branch_, submodule_, url_));
|
||||
git(root_, this).add_submodule(branch_, submodule_, url_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-2
@@ -27,8 +27,8 @@ public:
|
||||
|
||||
void add_remote(
|
||||
const std::string& remote_name,
|
||||
const std::string& org, const std::string& key,
|
||||
bool push_default, const std::string& url_pattern={});
|
||||
const std::string& org, const std::string& key, bool push_default,
|
||||
const std::string& url_pattern={}, const std::string& git_file={});
|
||||
|
||||
void rename_remote(const std::string& from, const std::string& to);
|
||||
|
||||
@@ -48,6 +48,10 @@ public:
|
||||
|
||||
void checkout(const std::string& what);
|
||||
|
||||
void add_submodule(
|
||||
const std::string& branch, const std::string& submodule,
|
||||
const mob::url& url);
|
||||
|
||||
std::string current_branch();
|
||||
|
||||
bool is_git_repo();
|
||||
|
||||
@@ -30,10 +30,11 @@ void basic_process_runner::do_interrupt()
|
||||
process_->interrupt();
|
||||
}
|
||||
|
||||
int basic_process_runner::execute_and_join(const process& p)
|
||||
int basic_process_runner::execute_and_join(process& p)
|
||||
{
|
||||
set_process(p);
|
||||
return execute_and_join();
|
||||
set_name(p.name());
|
||||
p.set_context(&cx());
|
||||
return p.run_and_join();
|
||||
}
|
||||
|
||||
int basic_process_runner::execute_and_join()
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ public:
|
||||
basic_process_runner(basic_process_runner&&);
|
||||
~basic_process_runner();
|
||||
|
||||
int execute_and_join(const process& p);
|
||||
int execute_and_join(process& p);
|
||||
void join();
|
||||
|
||||
int exit_code() const;
|
||||
|
||||
Reference in New Issue
Block a user