mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02: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
1 changed files with 9 additions and 3 deletions
|
@ -433,9 +433,15 @@ struct GitLabInputScheme : GitArchiveInputScheme
|
|||
store->toRealPath(
|
||||
downloadFile(store, url, "source", headers).storePath)));
|
||||
|
||||
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 a new issue