diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index 910451a84..53d9b1117 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -401,12 +401,12 @@ struct RetrieveRegularNARVisitor : NARParseVisitor box_ptr 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"); } }; } diff --git a/tests/functional/add.sh b/tests/functional/add.sh index 5c3eed793..38ce9d2d9 100644 --- a/tests/functional/add.sh +++ b/tests/functional/add.sh @@ -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 diff --git a/tests/functional/symlink b/tests/functional/symlink new file mode 120000 index 000000000..429f42921 --- /dev/null +++ b/tests/functional/symlink @@ -0,0 +1 @@ +add.sh \ No newline at end of file