mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Specialize LocalOverlayStore::queryPathFromHashPart
With test
This commit is contained in:
parent
ddaf2750b5
commit
e7c3399ed2
3 changed files with 20 additions and 0 deletions
|
@ -98,6 +98,16 @@ bool LocalOverlayStore::isValidPathUncached(const StorePath & path)
|
|||
}
|
||||
|
||||
|
||||
std::optional<StorePath> LocalOverlayStore::queryPathFromHashPart(const std::string & hashPart)
|
||||
{
|
||||
auto res = LocalStore::queryPathFromHashPart(hashPart);
|
||||
if (res)
|
||||
return res;
|
||||
else
|
||||
return lowerStore->queryPathFromHashPart(hashPart);
|
||||
}
|
||||
|
||||
|
||||
void LocalOverlayStore::registerValidPaths(const ValidPathInfos & infos)
|
||||
{
|
||||
// First, get any from lower store so we merge
|
||||
|
|
|
@ -89,6 +89,8 @@ private:
|
|||
|
||||
bool isValidPathUncached(const StorePath & path) override;
|
||||
|
||||
std::optional<StorePath> queryPathFromHashPart(const std::string & hashPart) override;
|
||||
|
||||
void registerValidPaths(const ValidPathInfos & infos) override;
|
||||
|
||||
void addToStore(const ValidPathInfo & info, Source & source,
|
||||
|
|
|
@ -60,6 +60,14 @@ nix-store --verify-path --store "$storeA" "$path"
|
|||
# Verifying path in merged-store
|
||||
nix-store --verify-path --store "$storeB" "$path"
|
||||
|
||||
hashPart=$(echo $path | sed "s^$NIX_STORE_DIR/^^" | sed 's/-.*//')
|
||||
|
||||
# Lower store can find from hash part
|
||||
[[ $(nix store --store $storeA path-from-hash-part $hashPart) == $path ]]
|
||||
|
||||
# merged store can find from hash part
|
||||
[[ $(nix store --store $storeB path-from-hash-part $hashPart) == $path ]]
|
||||
|
||||
### Do a redundant add
|
||||
|
||||
# upper layer should not have it
|
||||
|
|
Loading…
Reference in a new issue