mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 00:08:07 +02:00
Merge pull request #10176 from NixOS/relative-path-fingerprint
PathInputScheme::getFingerprint(): Don't barf on relative paths
This commit is contained in:
commit
fb37e184a5
1 changed files with 12 additions and 0 deletions
|
@ -89,6 +89,15 @@ struct PathInputScheme : InputScheme
|
|||
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
|
||||
{
|
||||
return (bool) input.getNarHash();
|
||||
|
@ -151,6 +160,9 @@ struct PathInputScheme : InputScheme
|
|||
|
||||
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
|
||||
store object and the subpath. */
|
||||
auto path = getAbsPath(input);
|
||||
|
|
Loading…
Reference in a new issue