8000
Skip to content

Add git bare root namer#319

Merged
joshmedeski merged 2 commits intomainfrom
root-worktree-fix
Jan 14, 2026
Merged

Add git bare root namer#319
joshmedeski merged 2 commits intomainfrom
root-worktree-fix

Conversation

@joshmedeski
Copy link
Copy Markdown
Owner

Summary

  • Fix sesh root command to properly detect git worktrees from bare clones with .git folder convention
  • Add new gitBareRootName strategy that returns the bare repo name plus the worktree directory (e.g., myrepo/main)

Problem

The RootName() function only used git rev-parse --show-toplevel, which returns the worktree directory itself rather than the parent repository root for bare clone setups. This caused sesh root to return just the worktree name (e.g., main) instead of including the repo context.

Solution

Created a new gitBareRootName strategy in namer/root_git_bare.go that:

  1. Detects bare worktrees using the existing getBareWorktreePath() function
  2. Combines the bare repo root name with the worktree's relative path
  3. Returns a contextual name like myrepo/main instead of just main

Added this strategy as the first option in RootName() so bare worktrees are detected before falling back to standard git detection.

Detects a bare clone's worktree dir to make root more contextual
@joshmedeski joshmedeski merged commit 04d1cc1 into main Jan 14, 2026
4 checks passed
@joshmedeski joshmedeski deleted the root-worktree-fix branch January 14, 2026 19:28
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

0