Skip to content

Commit b3e9204

Browse files
authored
Merge pull request #12459 from NixOS/mergify/bp/2.26-maintenance/pr-12458
lockFlake(): When refetching a locked flake, use the locked ref (backport #12458)
2 parents 49f226e + 0ff1901 commit b3e9204

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libflake/flake/flake.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,12 @@ LockedFlake lockFlake(
554554

555555
/* Get the input flake, resolve 'path:./...'
556556
flakerefs relative to the parent flake. */
557-
auto getInputFlake = [&]()
557+
auto getInputFlake = [&](const FlakeRef & ref)
558558
{
559559
if (auto resolvedPath = resolveRelativePath()) {
560-
return readFlake(state, *input.ref, *input.ref, *input.ref, *resolvedPath, inputPath);
560+
return readFlake(state, ref, ref, ref, *resolvedPath, inputPath);
561561
} else {
562-
return getFlake(state, *input.ref, useRegistries, flakeCache, inputPath);
562+
return getFlake(state, ref, useRegistries, flakeCache, inputPath);
563563
}
564564
};
565565

@@ -640,7 +640,7 @@ LockedFlake lockFlake(
640640
}
641641

642642
if (mustRefetch) {
643-
auto inputFlake = getInputFlake();
643+
auto inputFlake = getInputFlake(oldLock->lockedRef);
644644
nodePaths.emplace(childNode, inputFlake.path.parent());
645645
computeLocks(inputFlake.inputs, childNode, inputPath, oldLock, followsPrefix,
646646
inputFlake.path, false);
@@ -668,7 +668,7 @@ LockedFlake lockFlake(
668668
auto ref = (input2.ref && explicitCliOverrides.contains(inputPath)) ? *input2.ref : *input.ref;
669669

670670
if (input.isFlake) {
671-
auto inputFlake = getInputFlake();
671+
auto inputFlake = getInputFlake(*input.ref);
672672

673673
auto childNode = make_ref<LockedNode>(
674674
inputFlake.lockedRef,

0 commit comments

Comments
 (0)