|
|
|
|
@ -715,31 +715,19 @@ void Directories::remove_path(const boost::filesystem::path &dir_path) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Directories::colorize_path(boost::filesystem::path dir_path_, bool include_parent_paths) { |
|
|
|
|
auto dir_path = std::make_shared<boost::filesystem::path>(std::move(dir_path_)); |
|
|
|
|
auto it = directories.find(dir_path->string()); |
|
|
|
|
void Directories::colorize_path(boost::filesystem::path dir_path, bool include_parent_paths) { |
|
|
|
|
auto it = directories.find(dir_path.string()); |
|
|
|
|
if(it == directories.end()) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
if(!boost::filesystem::exists(*dir_path, ec)) { |
|
|
|
|
if(!boost::filesystem::exists(dir_path, ec)) { |
|
|
|
|
directories.erase(it); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(it->second.repository) { |
|
|
|
|
auto repository = it->second.repository; |
|
|
|
|
thread_pool.push([this, dir_path, repository, include_parent_paths] { |
|
|
|
|
Git::Repository::Status status; |
|
|
|
|
try { |
|
|
|
|
status = repository->get_status(); |
|
|
|
|
} |
|
|
|
|
catch(const std::exception &e) { |
|
|
|
|
Terminal::get().async_print(std::string("\e[31mError (git)\e[m: ") + e.what() + '\n', true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dispatcher.post([this, dir_path, include_parent_paths, status = std::move(status)] { |
|
|
|
|
auto it = directories.find(dir_path->string()); |
|
|
|
|
auto colorize = [this, dir_path = std::move(dir_path), include_parent_paths](const Git::Repository::Status &status = {}) { |
|
|
|
|
auto it = directories.find(dir_path.string()); |
|
|
|
|
if(it == directories.end()) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
@ -800,7 +788,23 @@ void Directories::colorize_path(boost::filesystem::path dir_path_, bool include_
|
|
|
|
|
auto parent_path = boost::filesystem::path(it->first).parent_path(); |
|
|
|
|
it = directories.find(parent_path.string()); |
|
|
|
|
} while(it != directories.end()); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if(it->second.repository) { |
|
|
|
|
thread_pool.push([this, repository = it->second.repository, colorize = std::move(colorize)] { |
|
|
|
|
Git::Repository::Status status; |
|
|
|
|
try { |
|
|
|
|
status = repository->get_status(); |
|
|
|
|
} |
|
|
|
|
catch(const std::exception &e) { |
|
|
|
|
Terminal::get().async_print(std::string("\e[31mError (git)\e[m: ") + e.what() + '\n', true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dispatcher.post([colorize = std::move(colorize), status = std::move(status)] { |
|
|
|
|
colorize(status); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
colorize(); |
|
|
|
|
} |
|
|
|
|
|