Skip to content

fix: bare worktree regression after bump to gix v0.85#193

Merged
junglerobba merged 2 commits into
jrmoulton:mainfrom
jason5122:gix-0.85-worktree-regression-fix
Jul 7, 2026
Merged

fix: bare worktree regression after bump to gix v0.85#193
junglerobba merged 2 commits into
jrmoulton:mainfrom
jason5122:gix-0.85-worktree-regression-fix

Conversation

@jason5122

Copy link
Copy Markdown
Contributor

Regressions

#192 introduced two regressions for bare worktrees:

  1. Opening a worktree as a session now opens all worktrees as windows.
  2. The session working dir is $GIT_DIR/worktrees/<name> instead of the path to the worktree.

Cause

gix 0.85 has two API changes:

  1. Repository::kind() returns Kind::Common for bare worktrees instead of Kind::LinkedWorkTree.
  2. is_bare() returns true despite the worktree having a checkout.

I'm pretty sure (1) is a gix bug. I made a PR to gix which should hopefully fix things! When that happens, we can revert the change to is_worktree(). Seems like (2) is an intentional API change.

Steps to Reproduce

mkdir -p /tmp/bug-demo && cd /tmp/bug-demo
git init --bare project
cd project
git worktree add master
git worktree add feature-a

cd ..
cat >config.toml <<EOF
list_worktrees = true

[[search_dirs]]
path = "/tmp/bug-demo"
depth = 1
EOF

TMS_CONFIG_FILE=/tmp/bug-demo/config.toml tms open-session 'project#master'
tmux list-windows -t 'project#master'
tmux display-message -t 'project#master' -p '#{session_path}'

Before

$ tmux list-windows -t 'project#master'
1: master- (1 panes) [181x50] [layout 2c0e,181x50,0,0,135] @134
2: feature-a* (1 panes) [181x50] [layout 2c0f,181x50,0,0,136] @135 (active)

$ tmux display-message -t 'project#master' -p '#{session_path}'
/private/tmp/bug-demo/project/worktrees/master

After

$ tmux list-windows -t 'project#master'
1: zsh* (1 panes) [181x50] [layout ac12,181x50,0,0,168] @166 (active)

$ tmux display-message -t 'project#master' -p '#{session_path}'
/private/tmp/bug-demo/project/master

Comment thread src/repos.rs
match self {
RepoProvider::Git(repo) => {
matches!(repo.kind(), gix::repository::Kind::LinkedWorkTree)
|| repo.workdir().is_some_and(|wd| wd.join(".git").is_file())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a comment here that this is (probably) a temp workaround that should be dropped eventually?

@jason5122 jason5122 requested a review from junglerobba July 7, 2026 16:23
jason5122 added 2 commits July 7, 2026 19:29
…dows

Regression caused by jrmoulton#192 and API change in gix 0.85:
`Repository::kind()` returns Kind::Common for bare worktrees instead of
Kind::LinkedWorkTree. When this is fixed, the change to `is_worktree()`
marked with todo can be reverted.
Regression caused by jrmoulton#192 and API change in gix 0.85:
`is_bare()` now returns true despite the worktree having a checkout, so
this meant the session working dir is $GIT_DIR/worktrees/<name> instead
of the path to the worktree.
@junglerobba junglerobba force-pushed the gix-0.85-worktree-regression-fix branch from 227c017 to 99dbb37 Compare July 7, 2026 17:33
@junglerobba junglerobba merged commit 99dbb37 into jrmoulton:main Jul 7, 2026
2 checks passed
@junglerobba

Copy link
Copy Markdown
Collaborator

Thanks! Only applied some slight commit reorganization to keep the fixes in their own commits.

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.

2 participants