mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 09:06:15 +02:00
PathInputScheme::getFingerprint(): Don't barf on relative paths
This wasn't caught by CI because #10149 and #10152 pass individually... It doesn't happen on lazy-trees either because we never try to fetch relative path flakes (#10089).
This commit is contained in:
parent
da62528487
commit
0282499e18
1 changed files with 12 additions and 0 deletions
|
@ -89,6 +89,15 @@ struct PathInputScheme : InputScheme
|
||||||
writeFile((CanonPath(getAbsPath(input)) / path).abs(), contents);
|
writeFile((CanonPath(getAbsPath(input)) / path).abs(), contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> isRelative(const Input & input) const
|
||||||
|
{
|
||||||
|
auto path = getStrAttr(input.attrs, "path");
|
||||||
|
if (hasPrefix(path, "/"))
|
||||||
|
return std::nullopt;
|
||||||
|
else
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
bool isLocked(const Input & input) const override
|
bool isLocked(const Input & input) const override
|
||||||
{
|
{
|
||||||
return (bool) input.getNarHash();
|
return (bool) input.getNarHash();
|
||||||
|
@ -151,6 +160,9 @@ struct PathInputScheme : InputScheme
|
||||||
|
|
||||||
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
|
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
|
||||||
{
|
{
|
||||||
|
if (isRelative(input))
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
/* If this path is in the Nix store, use the hash of the
|
/* If this path is in the Nix store, use the hash of the
|
||||||
store object and the subpath. */
|
store object and the subpath. */
|
||||||
auto path = getAbsPath(input);
|
auto path = getAbsPath(input);
|
||||||
|
|
Loading…
Reference in a new issue