libstore: don't abort when flat-importing non-files

fixes #705

Change-Id: I3be20235006425dd3bb6156510d021699f05b9ba
This commit is contained in:
eldritch horrors
2025-03-02 17:37:12 +00:00
parent 94f15cb5a4
commit 820c9bdaf5
3 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -401,12 +401,12 @@ struct RetrieveRegularNARVisitor : NARParseVisitor
box_ptr<NARParseVisitor> createDirectory(const std::string & name) override
{
assert(false && "RetrieveRegularNARVisitor::createDirectory must not be called");
throw Error("cannot import directory using flat ingestion");
}
void createSymlink(const std::string & name, const std::string & target) override
{
assert(false && "RetrieveRegularNARVisitor::createSymlink must not be called");
throw Error("cannot import symlink using flat ingestion");
}
};
}
+6
View File
@@ -1,5 +1,11 @@
source common.sh
expectStderr 1 nix-store --add-fixed sha256 . | grep "cannot import directory using flat ingestion"
expectStderr 1 nix-store --add-fixed sha256 ./symlink | grep "cannot import symlink using flat ingestion"
expectStderr 1 nix-store --add-fixed sha1 . | grep "cannot import directory using flat ingestion"
expectStderr 1 nix-store --add-fixed sha1 ./symlink | grep "cannot import symlink using flat ingestion"
path1=$(nix-store --add ./dummy)
echo $path1
+1
View File
@@ -0,0 +1 @@
add.sh