Skip to content

Worktree base directory collisions when repositories share basename #101

@khoi

Description

@khoi

Summary

Supacode’s default worktree base-directory identity is not unique across repositories. It derives from repository basename, so different repos with the same folder name can collide.

User-visible problems

  • Two different repos can map to the same ~/.supacode/repos/<name> base directory.
  • Worktrees from unrelated repos can be mixed under the same parent.
  • Worktree creation/listing/removal can become ambiguous or behave unexpectedly.

Reproduction

  1. Have two different git repositories with the same last path component, e.g.:
    • /Users/me/src/org-a/app
    • /Users/me/src/org-b/app
  2. Add both repositories to Supacode.
  3. Create worktrees in each repository.
  4. Observe both repos targeting the same Supacode base path under ~/.supacode/repos/app.

Expected

  • Different repository roots should always map to different Supacode worktree base directories by default.
  • No manual configuration should be required to avoid collisions.

Actual

  • Default naming is basename-based, so repos that share a basename collide.
  • Current manual repositoryName override can work around this, but default behavior remains collision-prone.

Why this matters

This breaks common worktree layouts (including bare-repo + .bare setups) and makes repository identity fragile in real-world monorepo/multi-org directory structures.

Suggested direction

Use a deterministic unique default directory identity derived from repository root (or remote identity), while keeping a separate user-facing display name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions