mirror of
https://github.com/NixOS/nix
synced 2025-07-04 11:21:47 +02:00
Only rewrite the lockfile if it changed
This removes spurious warnings about failure to write the lockfile.
This commit is contained in:
parent
818c8da5b8
commit
20a1a65d37
2 changed files with 37 additions and 12 deletions
|
@ -24,6 +24,11 @@ struct LockFile
|
|||
FlakeRef ref;
|
||||
Hash contentHash;
|
||||
NonFlakeEntry(const FlakeRef & flakeRef, const Hash & hash) : ref(flakeRef), contentHash(hash) {};
|
||||
|
||||
bool operator ==(const NonFlakeEntry & other) const
|
||||
{
|
||||
return ref == other.ref && contentHash == other.contentHash;
|
||||
}
|
||||
};
|
||||
|
||||
struct FlakeEntry
|
||||
|
@ -33,10 +38,26 @@ struct LockFile
|
|||
std::map<FlakeRef, FlakeEntry> flakeEntries;
|
||||
std::map<FlakeAlias, NonFlakeEntry> nonFlakeEntries;
|
||||
FlakeEntry(const FlakeRef & flakeRef, const Hash & hash) : ref(flakeRef), contentHash(hash) {};
|
||||
|
||||
bool operator ==(const FlakeEntry & other) const
|
||||
{
|
||||
return
|
||||
ref == other.ref
|
||||
&& contentHash == other.contentHash
|
||||
&& flakeEntries == other.flakeEntries
|
||||
&& nonFlakeEntries == other.nonFlakeEntries;
|
||||
}
|
||||
};
|
||||
|
||||
std::map<FlakeRef, FlakeEntry> flakeEntries;
|
||||
std::map<FlakeAlias, NonFlakeEntry> nonFlakeEntries;
|
||||
|
||||
bool operator ==(const LockFile & other) const
|
||||
{
|
||||
return
|
||||
flakeEntries == other.flakeEntries
|
||||
&& nonFlakeEntries == other.nonFlakeEntries;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<std::shared_ptr<FlakeRegistry>> Registries;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue