1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 00:12:43 +01:00

libfetchers: Restore path separator ignoring behavior for indirect and git-archive flakerefs

Old versions of nix happily accepted a lot of weird flake references,
which we didn't have tests for, so this was accidentally broken in
c436b7a32a.

This patch restores previous behavior and adds a plethora of tests
to ensure we don't break this in the future.

These test cases are aligned with how 2.18/2.28 parsed flake references.
This commit is contained in:
Sergei Zimmerman 2025-08-30 14:40:56 +03:00
parent 511d885d60
commit a38ebdd511
No known key found for this signature in database
5 changed files with 184 additions and 2 deletions

View file

@ -38,7 +38,8 @@ struct GitArchiveInputScheme : InputScheme
if (url.scheme != schemeName())
return {};
const auto & path = url.path;
/* This ignores empty path segments for back-compat. Older versions used a tokenizeString here. */
auto path = url.pathSegments(/*skipEmpty=*/true) | std::ranges::to<std::vector<std::string>>();
std::optional<Hash> rev;
std::optional<std::string> ref;