In a bare repo layout the template var `repo` resolves to .git
I am using the following (bare repository layout](https://worktrunk.dev/tips-patterns/#bare-repository-layout):
myproject/
├── .git/ # bare repository
├── main/ # default branch
├── feature/ # feature branch
└── bugfix/ # bugfix branch
The template vars show repo=".git" — worktrunk is deriving the repo name from the main_worktree path which is .git.
IMHO, this is a worktrunk bug in case the repo is a bare git directory at myproject/.git, so the repo name becomes .git instead of myproject.
I would expect the repo name come from the remote URL or the parent directory, because all repos with the same layout will have the same repo name "git". This makes something like subdomain routing with caddy kind of pointless.
Thanks for reporting this! I was able to reproduce the issue and identified the root cause: when the bare repo lives at project/.git, repo_path().file_name() returns .git instead of the project name, which gets used as the {{ repo }} template variable.
I've opened #1282 with a fix that adds a Repository::repo_name() method handling the nested bare repo layout (.git → parent directory name, .git suffix stripping, etc.) and replaces all the ad-hoc derivations. A maintainer will review it shortly.
Resolved by commit 5b67d386 (fix: resolve {{ repo }} to project name instead of .git in nested bare repos). The Repository::repo_name() method now correctly handles bare repo layouts — .git and .bare directories resolve to the parent project name.
I believe this still is an issue, or it has regressed.
Thanks for flagging this — you're right, it regressed. The fix from 5b67d386 was inadvertently undone by a subsequent refactor (#1280) that removed the repo_name() method while changing repo_path() to return Result.
I've opened #1544 to re-add repo_name() and restore the regression test.
Yes this wasn't merged — the history seems a bit muddled but https://github.com/max-sixty/worktrunk/pull/1281 was open and I was thinking about it, but then was closed and I dropped it. I just added a comment there, feedback welcome
Thanks for the clarification — you're right, the original fix from #1282 was never merged, and #1544 (which I just opened) uses the same path-heuristic approach that was already discussed and rejected on #1281. I'm closing #1544 now.
The discussion on #1281 is converging toward a user-facing warning/prompt when {{ repo }} resolves to a hidden directory in bare repos, rather than trying to guess the right name automatically. That seems like the right path forward.