From d5f1cc3e949ebb8c69b6c0d202302b12839b9bd5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Nov 2019 12:01:37 +0100 Subject: [PATCH] Use revcount/last-modified for computing the flake fingerprint The store path is not enough. For example, when we build a dirty tree, commit, and build the clean tree, a re-evaluation is necessary because the flake may depend on the lastModified or revCount attributes. --- src/libexpr/flake/flake.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index d96c3c413..80726a257 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -686,7 +686,11 @@ Fingerprint ResolvedFlake::getFingerprint() const // and we haven't changed it, then it's sufficient to use // flake.sourceInfo.storePath for the fingerprint. return hashString(htSHA256, - fmt("%s;%s", flake.sourceInfo.storePath, lockFile)); + fmt("%s;%d;%d;%s", + flake.sourceInfo.storePath, + flake.sourceInfo.revCount.value_or(0), + flake.sourceInfo.lastModified.value_or(0), + lockFile)); } }