Keep pin-upgraded workbench paths relative for relocation
This commit is contained in:
@@ -8,6 +8,7 @@ import { execFile as callback } from "node:child_process";
|
||||
import {
|
||||
planPinUpgrades,
|
||||
applyPinUpgrades,
|
||||
discoverUpgradeSpec,
|
||||
reviewUpgradeCandidate,
|
||||
type UpgradeEffects,
|
||||
} from "../src/capability-language/pin-upgrades.js";
|
||||
@@ -153,6 +154,21 @@ test(
|
||||
await run(workbench, "git", ["--git-dir", path.join(workbench, "remotes/named.git"), "show-ref"]),
|
||||
new RegExp(commit),
|
||||
);
|
||||
assert.equal(graph.resources[0].directory, "resources/Named");
|
||||
assert.equal(graph.directResources[0].directory, "resources/Named");
|
||||
// A retained workbench can move without keeping its original absolute path
|
||||
// alive. Recovery journals remain bound to their original writer/root.
|
||||
const relocated = `${workbench}-relocated`;
|
||||
context.after(() => fs.rm(relocated, { recursive: true, force: true }));
|
||||
await fs.cp(workbench, relocated, { recursive: true });
|
||||
const discovered = await discoverUpgradeSpec(relocated);
|
||||
assert.equal(discovered.nodes[1]!.directory, "resources/Named");
|
||||
const relocatedPlan = await planPinUpgrades(relocated, { ...discovered, bootstrap: true });
|
||||
assert.equal(relocatedPlan.workbench, relocated);
|
||||
assert.deepEqual(
|
||||
relocatedPlan.nodes.map((node) => node.directory),
|
||||
["resources/Named", "root"],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user