worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

In a bare repo layout the template var repo resolves to .git

Open sysradium opened this issue 8 months ago • 2 comments

I believe either it was not fixed or it has regressed: https://github.com/max-sixty/worktrunk/issues/1279 As I am getting same exact issue now

sysradium avatar Mar 15 '26 22:03 sysradium

Thanks for reporting this! I was able to reproduce the issue and identified the root cause: in the nested bare repo layout (project/.git), repo_path() returns the .git directory, and the {{ repo }} template variable was derived from its filename (.git) instead of the parent directory name (project).

The original fix from #1279 was never merged to main. I've opened #1545 with a fresh fix that adds a Repository::repo_name() method to handle .git/.bare directory names and .git suffixes. A maintainer will review it shortly.

worktrunk-bot avatar Mar 15 '26 22:03 worktrunk-bot

Resolved by #1656 (d989a3cd) — wt switch now detects bare repos at hidden paths like .git or .bare where {{ repo }} resolves to the hidden directory name, and offers to configure a worktree-path override using {{ repo_path }}/../{{ branch | sanitize }} instead.

worktrunk-bot avatar Mar 23 '26 06:03 worktrunk-bot