Skip to content

Commit

Permalink
reset URL via git remote set-url, update boost
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Gündling <felix.guendling@gmail.com>
  • Loading branch information
felixguendling committed Jun 3, 2024
1 parent 6fa6f5a commit 13c7824
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 27 deletions.
33 changes: 16 additions & 17 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ AlwaysBreakTemplateDeclarations: true
SpacesBeforeTrailingComments: 2
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 2
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 2
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
---
BasedOnStyle: Google
ColumnLimit: 80
Expand All @@ -37,12 +37,11 @@ AlwaysBreakTemplateDeclarations: true
SpacesBeforeTrailingComments: 2
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 2
Priority: 3
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<c.*'
Priority: 2
- Regex: '^<.*'
Priority: 4
- Regex: '.*'
Priority: 5
2 changes: 1 addition & 1 deletion deps/boost
Submodule boost updated 7026 files
2 changes: 2 additions & 0 deletions include/pkg/git.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ struct commit_info {
branch_commit bc_;
};

std::string ssh_to_https(std::string url);

std::string git_shorten(dep const*, std::string const& commit);

void git_clone(executor&, dep const*, bool clone_https);
Expand Down
3 changes: 3 additions & 0 deletions src/load_deps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ void load_deps(fs::path const& repo, fs::path const& deps_root,
(d->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");
}

Expand Down Expand Up @@ -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);
Expand Down
23 changes: 14 additions & 9 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 13c7824

Please sign in to comment.