Skip to content

Conversation

@junglerobba
Copy link
Collaborator

@junglerobba junglerobba commented Jun 24, 2025

#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
Copy link
Collaborator Author

junglerobba commented Jun 24, 2025

@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)

@SwannHERRERA
Copy link

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.

@jfroche
Copy link

jfroche commented Sep 9, 2025

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

Also adds a check to set_up_tmux_env so that when opening a worktree
directly, the main repo's other worktrees won't be opened as
windows. Since we're opening one directly, the assumption is that we
specificially want only the one selected.

Co-authored-by: junglerobba <junglerobba@jngl.one>
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.

3 participants