Skip to content

Workspaces: park a workspace's clones when the clone switches workspace - #30

Merged
bracyw merged 1 commit into
mainfrom
delphi-park-workspace-clones
Oct 9, 2026
Merged

bracyw merged 1 commit into
mainfrom
delphi-park-workspace-clones

Conversation

@bracyw

@bracyw bracyw commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Why

Switching a Delphi clone between ws/* branches and main left the git-ignored repos/, worktrees/ and references/ in place, so every workspace (and main) saw every other workspace's clones.

What

  • A new managed hook, park.sh, which setup.sh installs as the clone's post-checkout hook. When a checkout changes workspace, it renames the old workspace's clone folders into the git dir at delphi/<name>/ and renames the new one's back. main has no workspace, so it shows only its own files.
  • Renames are instant and keep every absolute path the same once a workspace is checked out again, so worktree links and build caches stay valid with nothing to repair or rebuild.
  • Branches of the same workspace move nothing. A folder in the way is reported, never overwritten. An existing hook (e.g. Git LFS) is left alone with a warning.
  • workspace.yml gains name: (the folder name) so a checkout knows which workspace it is. check.sh requires it to match the folder and rejects it in defaults/; new-workspace.sh sets it.

Testing

tests/e2e.sh adds coverage for parking, restoring, round trips, a folder in the way, and keeping a foreign hook (47 checks pass); ci/check.sh passes. Also exercised in a mock clone under macOS /bin/bash 3.2, including linked Delphi worktrees.

Existing clones pick it up by re-running setup once.

One Delphi clone can now switch freely between ws/* branches and main. setup.sh installs
.delphi/park.sh as the post-checkout hook: when a checkout changes the workspace (the new `name:`
in workspace.yml), it renames the old workspace's repos/, worktrees/ and references/ into the git
dir at delphi/<name>/ and renames the new one's back, so other workspaces never see them and every
path is unchanged when they return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bracyw
bracyw merged commit cbc9da9 into main Oct 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant