1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Rename allowRelative -> preserveRelativePaths

This commit is contained in:
Eelco Dolstra 2025-01-07 13:43:56 +01:00
parent 75cda2da7f
commit e8c7dd9971
2 changed files with 8 additions and 8 deletions

View file

@ -49,9 +49,9 @@ FlakeRef parseFlakeRef(
const std::optional<Path> & baseDir, const std::optional<Path> & baseDir,
bool allowMissing, bool allowMissing,
bool isFlake, bool isFlake,
bool allowRelative) bool preserveRelativePaths)
{ {
auto [flakeRef, fragment] = parseFlakeRefWithFragment(fetchSettings, url, baseDir, allowMissing, isFlake, allowRelative); auto [flakeRef, fragment] = parseFlakeRefWithFragment(fetchSettings, url, baseDir, allowMissing, isFlake, preserveRelativePaths);
if (fragment != "") if (fragment != "")
throw Error("unexpected fragment '%s' in flake reference '%s'", fragment, url); throw Error("unexpected fragment '%s' in flake reference '%s'", fragment, url);
return flakeRef; return flakeRef;
@ -89,7 +89,7 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
const std::optional<Path> & baseDir, const std::optional<Path> & baseDir,
bool allowMissing, bool allowMissing,
bool isFlake, bool isFlake,
bool allowRelative) bool preserveRelativePaths)
{ {
std::string path = url; std::string path = url;
std::string fragment = ""; std::string fragment = "";
@ -191,7 +191,7 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
} }
} else { } else {
if (!allowRelative && !hasPrefix(path, "/")) if (!preserveRelativePaths && !hasPrefix(path, "/"))
throw BadURL("flake reference '%s' is not an absolute path", url); throw BadURL("flake reference '%s' is not an absolute path", url);
} }
@ -258,7 +258,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
const std::optional<Path> & baseDir, const std::optional<Path> & baseDir,
bool allowMissing, bool allowMissing,
bool isFlake, bool isFlake,
bool allowRelative) bool preserveRelativePaths)
{ {
using namespace fetchers; using namespace fetchers;
@ -267,7 +267,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
} else if (auto res = parseURLFlakeRef(fetchSettings, url, baseDir, isFlake)) { } else if (auto res = parseURLFlakeRef(fetchSettings, url, baseDir, isFlake)) {
return *res; return *res;
} else { } else {
return parsePathFlakeRefWithFragment(fetchSettings, url, baseDir, allowMissing, isFlake, allowRelative); return parsePathFlakeRefWithFragment(fetchSettings, url, baseDir, allowMissing, isFlake, preserveRelativePaths);
} }
} }

View file

@ -85,7 +85,7 @@ FlakeRef parseFlakeRef(
const std::optional<Path> & baseDir = {}, const std::optional<Path> & baseDir = {},
bool allowMissing = false, bool allowMissing = false,
bool isFlake = true, bool isFlake = true,
bool allowRelative = false); bool preserveRelativePaths = false);
/** /**
* @param baseDir Optional [base directory](https://nixos.org/manual/nix/unstable/glossary#gloss-base-directory) * @param baseDir Optional [base directory](https://nixos.org/manual/nix/unstable/glossary#gloss-base-directory)
@ -104,7 +104,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
const std::optional<Path> & baseDir = {}, const std::optional<Path> & baseDir = {},
bool allowMissing = false, bool allowMissing = false,
bool isFlake = true, bool isFlake = true,
bool allowRelative = false); bool preserveRelativePaths = false);
/** /**
* @param baseDir Optional [base directory](https://nixos.org/manual/nix/unstable/glossary#gloss-base-directory) * @param baseDir Optional [base directory](https://nixos.org/manual/nix/unstable/glossary#gloss-base-directory)