Set locked flag

This commit is contained in:
Eelco Dolstra 2022-06-01 13:16:23 +02:00
parent 04d5417755
commit f917970df8
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 4 additions and 8 deletions

View file

@ -682,14 +682,6 @@ LockedFlake lockFlake(
flake->lockedRef.input.getRev() && flake->lockedRef.input.getRev() &&
prevLockedRef.input.getRev() != flake->lockedRef.input.getRev()) prevLockedRef.input.getRev() != flake->lockedRef.input.getRev())
warn("committed new revision '%s'", flake->lockedRef.input.getRev()->gitRev()); 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 } else
throw Error("cannot write modified lock file of flake '%s' (use '--no-write-lock-file' to ignore)", topRef); throw Error("cannot write modified lock file of flake '%s' (use '--no-write-lock-file' to ignore)", topRef);

View file

@ -741,6 +741,8 @@ struct GitInputScheme : InputScheme
input.attrs.insert_or_assign( input.attrs.insert_or_assign(
"revCount", "revCount",
getRevCount(repoInfo, repoInfo.url, *input.getRev())); getRevCount(repoInfo, repoInfo.url, *input.getRev()));
input.locked = true;
} }
// FIXME: maybe we should use the timestamp of the last // FIXME: maybe we should use the timestamp of the last

View file

@ -192,6 +192,8 @@ struct GitArchiveInputScheme : InputScheme
auto rev = input.getRev(); auto rev = input.getRev();
if (!rev) rev = getRevFromRef(store, input); if (!rev) rev = getRevFromRef(store, input);
input.locked = true;
input.attrs.erase("ref"); input.attrs.erase("ref");
input.attrs.insert_or_assign("rev", rev->gitRev()); input.attrs.insert_or_assign("rev", rev->gitRev());