tmux-sessionizer icon indicating copy to clipboard operation
tmux-sessionizer copied to clipboard

Add config option for listing worktrees for bare repositories

Open junglerobba opened this issue 8 months ago • 3 comments

https://github.com/jrmoulton/tmux-sessionizer/pull/143 redone on top of latest main, which actually means that not much was kept since quite a bit has changed since then :)

Because jj doesn't store the location of workspaces, and with the option enabled we'd be checking workspaces of all repos, without any optimizations the existing solution was very slow since for each repo we'd go over all configured search paths and look for jj workspaces. There are discussions on it, so in the future jj might actually know the locations of workspaces, and then this will become obsolete, but for now I tried to optimize it by first gathering a list of all workspace names (these are known by jj), and then seeing if all of them could be found inside of the current repo's directory (if bare). If not, we'd go back to scanning all search paths again. (So there's probably still some room for optimizations). But in the case of having no workspaces at all, neither of these things will be done. I don't know if the number of repos I have is anything close to representative, so I'd be glad for some testing and reports of how this performs :)

junglerobba avatar Jun 24 '25 18:06 junglerobba

@SwannHERRERA please also check if this still does what you wanted, since I didn't keep much of the old implementation, and don't actually use worktrees/workspaces that much myself (yet, apart from testing these PRs)

junglerobba avatar Jun 24 '25 18:06 junglerobba

Yes that almost what I wanted, the only difference is that it will not open one window per worktree but only one. But I think it's just a matter of preference. I also stop using worktree.

About the performance I don't have any clue. I will try jj you gave me want to try it ! Thanks for taking care of this.

SwannHERRERA avatar Jul 03 '25 20:07 SwannHERRERA

It seem we continue to exclude bare worktrees in find_repos: https://github.com/jrmoulton/tmux-sessionizer/pull/166/files#diff-6eeafb75f00cdcc59116813c491a1800b596b6eb4d70e85bd145df2e8838f7a3L293-R313

My layout might be different than what this change expect:

tmux-sessionizer-clone/
├── .git    (file with gitdir pointing to `./.bare`)
├── .bare
│   ├── hooks
│   ├── info
│   ├── logs
│   │   └── refs
│   ├── objects
│   ├── refs
│   │   ├── heads
│   │   ├── remotes
│   │   └── tags
│   └── worktrees
│       ├── main
│       └── push-uxlspvklmksr
├── main
|   ├── .git    (file with gitdir pointing to `tmux-sessionizer/.bare/worktrees/main`)
|   └── ...
└── push-uxlspvklmksr
    ├── .git    (file with gitdir pointing to `tmux-sessionizer/.bare/worktrees/push-uxlspvklmksr`)
    └── ...

When commenting the above lines, I get to select tmux-sessionizer/.bare/worktrees

jfroche avatar Sep 09 '25 10:09 jfroche