mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Add error message when git returns non-0 for fetch
Users have complained that fetchGit is flaky however the culprit is likely that `git fetch` was unable itself to download the repository for whatever reason (i.e. poor network etc..) Nothing was checking the status of `git fetch` and the error message that would eventually surface to the users were that the commit was not found. Add explicit error checking for status code from `git fetch` and return a message earlier on to indicate that the failure was from that point. fixes #10431
This commit is contained in:
parent
1272c4957f
commit
8e8416387c
1 changed files with 5 additions and 1 deletions
|
|
@ -545,7 +545,7 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||
append(gitArgs, {"--depth", "1"});
|
||||
append(gitArgs, {std::string("--"), url, refspec});
|
||||
|
||||
runProgram(RunOptions {
|
||||
auto [status, output] = runProgram(RunOptions {
|
||||
.program = "git",
|
||||
.lookupPath = true,
|
||||
// FIXME: git stderr messes up our progress indicator, so
|
||||
|
|
@ -554,6 +554,10 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||
.input = {},
|
||||
.isInteractive = true
|
||||
});
|
||||
|
||||
if (status > 0) {
|
||||
throw Error("Failed to fetch git repository %s: %s", url, output);
|
||||
}
|
||||
}
|
||||
|
||||
void verifyCommit(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue