jesseduffield.lazygit/pkg/commands
Stefan Haller d2d5bdc2bc Identify the current and main worktree by git dir, not by path
`git worktree list` reports the main worktree as the common git dir with
a trailing "/.git" removed, which equals the working tree only when the
git dir sits inside it. In a submodule, a bare repo, or a repo using
core.worktree it doesn't, so comparing the reported path against the
working tree path matches nothing: no worktree is recognized as current
or as main. Most visibly, inside a submodule lazygit claimed we were in
a linked worktree named after the submodule, and offered to remove that
"worktree".

Comparing git dirs identifies a worktree unambiguously, so use that.
A worktree whose directory is gone has no git dir to compare, and there
we still have nothing better than its path.

The submodule tests were asserting the linked-worktree suffix in the
status view; it is gone now, and the repo name still says which
submodule we're in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 11:15:01 +02:00
..
direnv Offer direnv .envrc approval from inside lazygit 2026-06-04 09:05:01 +02:00
git_commands Identify the current and main worktree by git dir, not by path 2026-08-08 11:15:01 +02:00
git_config Pin the cached git config's commands to the repo directory 2026-07-20 17:07:39 +02:00
hosting_service Optimize regex compilations 2026-05-10 15:28:14 +02:00
models Carry aggregate check state with GitHub pull requests 2026-07-31 09:01:44 +02:00
oscommands Start all commands of a pipeline before waiting for any of them 2026-08-06 14:34:47 +02:00
patch Guard the patch builder against concurrent access 2026-07-17 12:35:54 +02:00
testdata Support opening lazygit in a submodule 2019-05-12 17:59:49 +10:00
git.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
git_cmd_obj_builder.go Pin git commands to the repo they were created for 2026-07-20 17:07:39 +02:00
git_cmd_obj_builder_test.go Pin git commands to the repo they were created for 2026-07-20 17:07:39 +02:00
git_cmd_obj_runner.go Back off exponentially between lock-error retries 2026-07-15 10:08:44 +02:00
git_cmd_obj_runner_test.go Back off exponentially between lock-error retries 2026-07-15 10:08:44 +02:00