jrmoulton/tmux-sessionizer

New session not being created on dirname clashes

Closed this issue · 5 comments

I have several git repos with same dirnames. I have submodules named "backend" and "frontend" on several projects. Since each submodule being its own repo, their names clash with each other. Sessionizer only creates one session with a given name, and then just attaches to the previous one if the dirname of a new session is the same.

One possible solution would be to prefix a session name with the parent dirname if name clash is possible. For example, if you have these repos:

  • project1/frontend
  • project2/frontend

you could make sessions with project1-frontend and project2-frontend names.
Max search depth won't help cause I want these repos to be searched

Just to clarify, --full-path config option only affects dirname appearance in a fzf search window and doesn't affect the name of created session

Ah I hadn't considered this use case. This would be great to fix. I've been swamped lately but I'll add this to my backlog of items to take care of. I would also definitely accept a PR that implements your suggestion of having a prefix name before the path. (would need to be careful of how to implement this in the config)

I'll take a look at this in a week or 2 if noone's gonna take it by then, a bit busy atm. I'll see what I can do.
If you have any concrete implementation suggestions (config options etc), I'd stick to that.

Wonder if this is still an issue with the submodules option that I added, because with that the session name is parent>submodule name, so they shouldn't clash. Or how do you get the situation where that's an issue?

I checked the current main and that one still clashes.

PR #88 changes the (default?) display of the projects, but still clashes if the folder name is the same:

projects/project-a/frontend/.git
projects/project-b/frontend/.git

Both would connect to the same session, and fresh tmux sessions were named frontend in both cases.
However, they would be displayed in tms as frontend and project-b/frontend.
IMO it would be nicer to use the same display pattern for both projects if there are clashes, but that might be out of scope for this.