Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion host-setup/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ swap_in() {

if exists "$tree"; then
is_ours "$tree" || die "$tree exists and this loader did not create it, so it will not be replaced. Choose another --dir."
remove_owned "$retired"
remove_owned "$retired" ||
die "Could not remove the previous tree at $retired, which an entry that will not go causes. Close what holds it or remove it by hand, then run this again."
mv "$tree" "$retired"
moved=true
fi
Expand Down
11 changes: 11 additions & 0 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,17 @@ def test_an_old_tree_beside_an_empty_name_does_not_stop_the_new_one_landing(self
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual((self.dir / "skills-tree" / "content").read_text(encoding="utf-8"), "new")

def test_a_leftover_old_tree_that_will_not_go_stops_the_swap_naming_its_path(self) -> None:
self.owned_tree("skills-tree.new", "new")
self.owned_tree("skills-tree", "live")
self.locked_entry(self.owned_tree("skills-tree.old", "old"))
result = self.run_loader("swap_in")
self.assertNotEqual(result.returncode, 0)
self.assertIn(
f"Could not remove the previous tree at {self.dir / 'skills-tree.old'}", result.stderr
)
self.assertEqual((self.dir / "skills-tree" / "content").read_text(encoding="utf-8"), "live")

def test_a_failed_swap_never_moves_a_foreign_old_tree_into_place(self) -> None:
self.owned_tree("skills-tree.new", "new")
foreign = self.dir / "skills-tree.old"
Expand Down
Loading