From f917970df86a554b75f12993405b7aa12b4bd7ae Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Jun 2022 13:16:23 +0200 Subject: [PATCH] Set locked flag --- src/libexpr/flake/flake.cc | 8 -------- src/libfetchers/git.cc | 2 ++ src/libfetchers/github.cc | 2 ++ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index e1c9f4ad4..81a1d3090 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -682,14 +682,6 @@ LockedFlake lockFlake( flake->lockedRef.input.getRev() && prevLockedRef.input.getRev() != flake->lockedRef.input.getRev()) warn("committed new revision '%s'", flake->lockedRef.input.getRev()->gitRev()); - - /* Make sure that we picked up the change, - i.e. the tree should usually be dirty - now. Corner case: we could have reverted from a - dirty to a clean tree! */ - if (flake->lockedRef.input == prevLockedRef.input - && !flake->lockedRef.input.isLocked()) - throw Error("'%s' did not change after I updated its 'flake.lock' file; is 'flake.lock' under version control?", flake->originalRef); } } else throw Error("cannot write modified lock file of flake '%s' (use '--no-write-lock-file' to ignore)", topRef); diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc index 34e1a8975..4505a6222 100644 --- a/src/libfetchers/git.cc +++ b/src/libfetchers/git.cc @@ -741,6 +741,8 @@ struct GitInputScheme : InputScheme input.attrs.insert_or_assign( "revCount", getRevCount(repoInfo, repoInfo.url, *input.getRev())); + + input.locked = true; } // FIXME: maybe we should use the timestamp of the last diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index da115478e..b27151cff 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -192,6 +192,8 @@ struct GitArchiveInputScheme : InputScheme auto rev = input.getRev(); if (!rev) rev = getRevFromRef(store, input); + input.locked = true; + input.attrs.erase("ref"); input.attrs.insert_or_assign("rev", rev->gitRev());