@paleo/worktree-env 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/setup-worktree.js +7 -0
- package/package.json +1 -1
package/dist/setup-worktree.js
CHANGED
|
@@ -270,6 +270,13 @@ async function handleRemove(args, ctx, run, config) {
|
|
|
270
270
|
const removeHere = Boolean(args["remove-here"]);
|
|
271
271
|
const registry = readSlots(ctx.mainWorktree, config.registryDir);
|
|
272
272
|
const target = resolveRemoveTarget(args, ctx, registry, removeHere);
|
|
273
|
+
// Refuse to remove while the detached finalize is still writing to slots.json / wt-setup.log:
|
|
274
|
+
// racing the two corrupts the registry and leaves the worktree directory orphaned.
|
|
275
|
+
if (registry.slots[target.slotPort]?.status === "pending") {
|
|
276
|
+
console.error(`Error: Setup is still in progress for slot ${target.slotPort}. ` +
|
|
277
|
+
`Run 'setup-worktree --wait --slot ${target.slotPort}' to wait for it to finish (or fail), then retry --remove.`);
|
|
278
|
+
process.exit(1);
|
|
279
|
+
}
|
|
273
280
|
if (!args["no-remote-check"]) {
|
|
274
281
|
verifyBranchAbsentFromRemote(target.branch, run);
|
|
275
282
|
}
|