diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-12-01 15:33:29 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-12-01 15:33:29 +0100 |
commit | 43a2b7947a4f836a44a447bedf5caca5a6937d20 (patch) | |
tree | 5f2a133a228fdbcc63ba8fc3dd2ee631f76a01e4 /src/other_tools/root_maps/commit_git_map.cpp | |
parent | ba36c00cc12ea868b14ad29a98a5c6cd0b18e2dc (diff) | |
download | justbuild-43a2b7947a4f836a44a447bedf5caca5a6937d20.tar.gz |
just-mr git: Report all tried remotes if fetch fails
Diffstat (limited to 'src/other_tools/root_maps/commit_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index 415d6dc6..6bf11efc 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -350,6 +350,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, // store failed attempts for subsequent logging bool fetched{false}; std::string err_messages{}; + // keep all remotes checked to report them in case fetch fails + std::string remotes_buffer{}; // try local mirrors first auto local_mirrors = MirrorsUtils::GetLocalMirrors(additional_mirrors, fetch_repo); @@ -373,6 +375,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, fetched = true; break; } + // add local mirror to buffer + remotes_buffer.append(fmt::format("\n> {}", mirror)); } if (not fetched) { // get preferred hostnames list @@ -403,6 +407,9 @@ void EnsureCommit(GitRepoInfo const& repo_info, fetched = true; break; } + // add preferred to buffer + remotes_buffer.append( + fmt::format("\n> {}", *preferred_url)); } } } @@ -422,6 +429,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, git_bin, launcher, wrapped_logger)) { + // add main fetch URL to buffer + remotes_buffer.append(fmt::format("\n> {}", fetch_repo)); // now try to fetch from mirrors, in order, if given for (auto mirror : repo_info.mirrors) { if (GitURLIsPath(mirror)) { @@ -453,6 +462,9 @@ void EnsureCommit(GitRepoInfo const& repo_info, fetched = true; break; } + // add preferred mirror to buffer + remotes_buffer.append(fmt::format( + "\n> {}", *preferred_mirror)); } } } @@ -478,6 +490,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, fetched = true; break; } + // add mirror to buffer + remotes_buffer.append(fmt::format("\n> {}", mirror)); } } } @@ -487,7 +501,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, (*logger)( fmt::format("While fetching via tmp repo:{}", err_messages), /*fatal=*/false); - (*logger)("Failed to fetch from provided remotes", + (*logger)(fmt::format("Failed to fetch from provided remotes:{}", + remotes_buffer), /*fatal=*/true); return; } |