1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 23:42:43 +01:00

NullFileSystemObjectSink: Skip over file contents

This commit is contained in:
Eelco Dolstra 2025-10-17 18:32:47 +02:00
parent daa7e0d2e9
commit 67bffa19a5
3 changed files with 16 additions and 1 deletions

View file

@ -132,6 +132,11 @@ static void parseContents(CreateRegularFileSink & sink, Source & source)
sink.preallocateContents(size);
if (sink.skipContents) {
source.skip(size + (size % 8 ? 8 - (size % 8) : 0));
return;
}
uint64_t left = size;
std::array<char, 65536> buf;
@ -166,7 +171,7 @@ static void parse(FileSystemObjectSink & sink, Source & source, const CanonPath
auto expectTag = [&](std::string_view expected) {
auto tag = getString();
if (tag != expected)
throw badArchive("expected tag '%s', got '%s'", expected, tag);
throw badArchive("expected tag '%s', got '%s'", expected, tag.substr(0, 1024));
};
expectTag("(");