1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00

Fix sourcehut tag ref resolving

This commit is contained in:
Gabriel Fontes 2022-03-19 10:56:13 -03:00
parent 8ad485ea89
commit 345a8ee0cb
No known key found for this signature in database
GPG key ID: 2E54EA7BFE630916

View file

@ -390,7 +390,7 @@ struct SourceHutInputScheme : GitArchiveInputScheme
ref_uri = line.substr(ref_index+5, line.length()-1);
} else
ref_uri = fmt("refs/heads/%s", ref);
ref_uri = fmt("refs/(heads|tags)/%s", ref);
auto file = store->toRealPath(
downloadFile(store, fmt("%s/info/refs", base_url), "source", false, headers).storePath);
@ -399,9 +399,9 @@ struct SourceHutInputScheme : GitArchiveInputScheme
std::string line;
std::string id;
while(getline(is, line)) {
auto index = line.find(ref_uri);
if (index != std::string::npos) {
id = line.substr(0, index-1);
std::regex pattern(ref_uri);
if (std::regex_search(line, pattern)) {
id = line.substr(0, line.find('\t'));
break;
}
}