diff --git a/.clang-format b/.clang-format index 45c0203..343110d 100644 --- a/.clang-format +++ b/.clang-format @@ -13,14 +13,14 @@ AlwaysBreakTemplateDeclarations: true SpacesBeforeTrailingComments: 2 IncludeBlocks: Preserve IncludeCategories: - - Regex: '^<.*\.h>' - Priority: 1 - - Regex: '^' + Priority: 1 + - Regex: '^' - Priority: 1 - - Regex: '^' + Priority: 1 + - Regex: '^commit_ != bc.commit_ && !commit_exists(d, bc.commit_))) { fmt::print("{}: fetch\n", d->name()); std::cout << std::flush; + e.exec(d->path_, "git remote set-url origin {}", + clone_https ? ssh_to_https(d->url_) : d->url_); e.exec(d->path_, "git fetch origin"); } @@ -141,6 +143,7 @@ void load_deps(fs::path const& repo, fs::path const& deps_root, } catch (std::exception const& e) { fmt::print("Checkout failed for {}: {}\n", d->name(), e.what()); ex.print_trace(); + throw; } } } while (repeat); diff --git a/src/main.cc b/src/main.cc index 0376460..596181e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -30,14 +30,19 @@ int main(int argc, char** argv) { return 0; } - auto const mode = std::string_view{argv[1]}; - set_verbose(has_flag(argc - 1, argv + 1, "-v")); - if (mode == "load" || mode == "-l") { - load_deps(fs::path{"."}, fs::path("deps"), // - has_flag(argc - 1, argv + 1, "-h"), // - has_flag(argc - 1, argv + 1, "-f"), // - has_flag(argc - 1, argv + 1, "-r")); - } else if (mode == "status" || mode == "-s") { - print_status(fs::path{"."}, fs::path("deps")); + try { + auto const mode = std::string_view{argv[1]}; + set_verbose(has_flag(argc - 1, argv + 1, "-v")); + if (mode == "load" || mode == "-l") { + load_deps(fs::path{"."}, fs::path("deps"), // + has_flag(argc - 1, argv + 1, "-h"), // + has_flag(argc - 1, argv + 1, "-f"), // + has_flag(argc - 1, argv + 1, "-r")); + } else if (mode == "status" || mode == "-s") { + print_status(fs::path{"."}, fs::path("deps")); + } + } catch (std::exception const& e) { + std::cerr << "error: " << e.what() << "\n"; + return 1; } }