diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-07-12 13:29:54 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-07-12 13:29:54 +0200 |
commit | b29cec76971ff1949415f76c82fa0ecf699ac264 (patch) | |
tree | 647165a0a2dc2cefb8d398776337de8d3f8aaa86 /src/libexpr/flake/lockfile.cc | |
parent | bd62290c23fa15181e8af75c5055e104900f8532 (diff) |
Don't write lock files if they have dirty inputs
Diffstat (limited to 'src/libexpr/flake/lockfile.cc')
-rw-r--r-- | src/libexpr/flake/lockfile.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libexpr/flake/lockfile.cc b/src/libexpr/flake/lockfile.cc index 97c748c66..15f2e2e8e 100644 --- a/src/libexpr/flake/lockfile.cc +++ b/src/libexpr/flake/lockfile.cc @@ -66,6 +66,17 @@ nlohmann::json FlakeInputs::toJson() const return json; } +bool FlakeInputs::isDirty() const +{ + for (auto & i : flakeInputs) + if (i.second.ref.isDirty() || i.second.isDirty()) return true; + + for (auto & i : nonFlakeInputs) + if (i.second.ref.isDirty()) return true; + + return false; +} + nlohmann::json LockFile::toJson() const { auto json = FlakeInputs::toJson(); |