jesseduffield.lazygit/pkg
Stefan Haller 0ce248d1bf Recognize a repo that has no work tree instead of bailing out
git makes `rev-parse --show-toplevel` fatal when there's no work tree,
so asking for it together with everything else meant we never got an
answer at all for a bare repo: GetRepoPaths returned an error, nobody
ever saw IsBareRepo() == true, and lazygit either died with a stack
trace or decided we weren't in a repository. That's what you got for
opening it in a directory holding a bare repo and a .git file pointing
at it, which is a normal way to keep a repo and its worktrees together.

Ask again without --show-toplevel when the first query fails: the other
queries work fine without a work tree, so if they now succeed we know
we're in a bare repo, and the existing prompt offering to open a recent
repo does its job. If they fail too we're not in a repo at all, and the
first error already says so.

--is-bare-repository is gone from the query: a work tree implies
core.bare is false, so it could only ever come back false there, and
what matters to us is whether there is a work tree to show, which is
what we now go by.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 11:15:01 +02:00
..
app Recognize a repo that has no work tree instead of bailing out 2026-08-08 11:15:01 +02:00
cheatsheet Render every key for a binding in the cheatsheet 2026-05-25 15:18:18 +02:00
commands Recognize a repo that has no work tree instead of bailing out 2026-08-08 11:15:01 +02:00
common Move NewDummyCommon to pkg/common 2025-05-06 09:43:26 +02:00
config Move Github PR cache out of state.yml into a separate file 2026-08-02 19:09:22 +02:00
constants Adapt links 2026-07-31 08:42:51 +02:00
env Support bare worktrees where worktree does not have its own .git file 2023-08-07 22:40:53 +10:00
fakes Modernize all codes 2025-11-15 10:46:23 +01:00
gocui Exclude more commit trailers from auto-wrapping 2026-08-02 19:22:34 +02:00
gui Don't clear gui.git when we fail to open a repo 2026-08-08 11:15:01 +02:00
i18n Recognize a repo that has no work tree instead of bailing out 2026-08-08 11:15:01 +02:00
integration Identify the current and main worktree by git dir, not by path 2026-08-08 11:15:01 +02:00
jsonschema Fold legacy quit-alt1 into the multi-key quit binding 2026-05-25 15:32:47 +02:00
logs Fix Windows linter errors 2026-06-16 16:21:13 +02:00
snake Enable intrange linter, and fix warnings 2025-06-30 18:30:11 +02:00
tasks Give task commands a Terminate method instead of exposing their process 2026-08-04 07:03:27 +02:00
theme Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
updates Change direct access to Common.UserConfig to a getter 2024-08-18 10:24:52 +02:00
utils Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00