mirror of
https://github.com/NixOS/nix.git
synced 2024-11-29 02:02:27 +00:00
Merge pull request #10811 from Mic92/fetcher-fix
libfetchers: handle nonexistent refs in GitLab repos more gracefully
This commit is contained in:
commit
962475d97f
@ -433,9 +433,15 @@ struct GitLabInputScheme : GitArchiveInputScheme
|
||||
store->toRealPath(
|
||||
downloadFile(store, url, "source", headers).storePath)));
|
||||
|
||||
return RefInfo {
|
||||
.rev = Hash::parseAny(std::string(json[0]["id"]), HashAlgorithm::SHA1)
|
||||
};
|
||||
if (json.is_array() && json.size() == 1 && json[0]["id"] != nullptr) {
|
||||
return RefInfo {
|
||||
.rev = Hash::parseAny(std::string(json[0]["id"]), HashAlgorithm::SHA1)
|
||||
};
|
||||
} if (json.is_array() && json.size() == 0) {
|
||||
throw Error("No commits returned by GitLab API -- does the git ref really exist?");
|
||||
} else {
|
||||
throw Error("Unexpected response received from GitLab: %s", json);
|
||||
}
|
||||
}
|
||||
|
||||
DownloadUrl getDownloadUrl(const Input & input) const override
|
||||
|
Loading…
Reference in New Issue
Block a user