mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
Test that nix-store --restore fails if the output already exists
This restores the behaviour from before the std::filesystem refactorings.
This commit is contained in:
parent
83d5b32803
commit
da1ad28912
@ -71,7 +71,8 @@ static GlobalConfig::Register r1(&restoreSinkSettings);
|
|||||||
|
|
||||||
void RestoreSink::createDirectory(const CanonPath & path)
|
void RestoreSink::createDirectory(const CanonPath & path)
|
||||||
{
|
{
|
||||||
std::filesystem::create_directory(dstPath / path.rel());
|
if (!std::filesystem::create_directory(dstPath / path.rel()))
|
||||||
|
throw Error("path '%s' already exists", (dstPath / path.rel()).string());
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RestoreRegularFile : CreateRegularFileSink {
|
struct RestoreRegularFile : CreateRegularFileSink {
|
||||||
|
@ -10,6 +10,9 @@ clearStore
|
|||||||
rm -rf "$TEST_ROOT/out"
|
rm -rf "$TEST_ROOT/out"
|
||||||
expectStderr 1 nix-store --restore "$TEST_ROOT/out" < duplicate.nar | grepQuiet "NAR directory is not sorted"
|
expectStderr 1 nix-store --restore "$TEST_ROOT/out" < duplicate.nar | grepQuiet "NAR directory is not sorted"
|
||||||
|
|
||||||
|
# Check that nix-store --restore fails if the output already exists.
|
||||||
|
expectStderr 1 nix-store --restore "$TEST_ROOT/out" < duplicate.nar | grepQuiet "path '.*/out/' already exists"
|
||||||
|
|
||||||
# Check whether restoring and dumping a NAR that contains case
|
# Check whether restoring and dumping a NAR that contains case
|
||||||
# collisions is round-tripping, even on a case-insensitive system.
|
# collisions is round-tripping, even on a case-insensitive system.
|
||||||
rm -rf "$TEST_ROOT/case"
|
rm -rf "$TEST_ROOT/case"
|
||||||
|
Loading…
Reference in New Issue
Block a user