1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 06:52:43 +01:00

Add a test for RefScanSink and clean up the code

Issue #5322.
This commit is contained in:
Eelco Dolstra 2021-10-04 14:29:42 +02:00
parent ef34fd0656
commit 77ebbc9f54
5 changed files with 105 additions and 30 deletions

View file

@ -9,6 +9,24 @@ std::pair<StorePathSet, HashResult> scanForReferences(const Path & path, const S
StorePathSet scanForReferences(Sink & toTee, const Path & path, const StorePathSet & refs);
class RefScanSink : public Sink
{
StringSet hashes;
StringSet seen;
std::string tail;
public:
RefScanSink(StringSet && hashes) : hashes(hashes)
{ }
StringSet & getResult()
{ return seen; }
void operator () (std::string_view data) override;
};
struct RewritingSink : Sink
{
std::string from, to, prev;