mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
Merge pull request #14204 from NixOS/kill-to-real-path-fetchers
libfetchers: Remove toRealPath in SourceHutInputScheme::getRevFromRef
This commit is contained in:
commit
2fc88ec114
1 changed files with 7 additions and 9 deletions
|
|
@ -548,13 +548,10 @@ struct SourceHutInputScheme : GitArchiveInputScheme
|
||||||
|
|
||||||
std::string refUri;
|
std::string refUri;
|
||||||
if (ref == "HEAD") {
|
if (ref == "HEAD") {
|
||||||
auto file = store->toRealPath(
|
auto downloadFileResult = downloadFile(store, *input.settings, fmt("%s/HEAD", base_url), "source", headers);
|
||||||
downloadFile(store, *input.settings, fmt("%s/HEAD", base_url), "source", headers).storePath);
|
auto contents = nix::ref(store->getFSAccessor(downloadFileResult.storePath))->readFile(CanonPath::root);
|
||||||
std::ifstream is(file);
|
|
||||||
std::string line;
|
|
||||||
getline(is, line);
|
|
||||||
|
|
||||||
auto remoteLine = git::parseLsRemoteLine(line);
|
auto remoteLine = git::parseLsRemoteLine(getLine(contents).first);
|
||||||
if (!remoteLine) {
|
if (!remoteLine) {
|
||||||
throw BadURL("in '%d', couldn't resolve HEAD ref '%d'", input.to_string(), ref);
|
throw BadURL("in '%d', couldn't resolve HEAD ref '%d'", input.to_string(), ref);
|
||||||
}
|
}
|
||||||
|
|
@ -564,9 +561,10 @@ struct SourceHutInputScheme : GitArchiveInputScheme
|
||||||
}
|
}
|
||||||
std::regex refRegex(refUri);
|
std::regex refRegex(refUri);
|
||||||
|
|
||||||
auto file = store->toRealPath(
|
auto downloadFileResult =
|
||||||
downloadFile(store, *input.settings, fmt("%s/info/refs", base_url), "source", headers).storePath);
|
downloadFile(store, *input.settings, fmt("%s/info/refs", base_url), "source", headers);
|
||||||
std::ifstream is(file);
|
auto contents = nix::ref(store->getFSAccessor(downloadFileResult.storePath))->readFile(CanonPath::root);
|
||||||
|
std::istringstream is(contents);
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
std::optional<std::string> id;
|
std::optional<std::string> id;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue