jesseduffield.lazygit/pkg/integration/tests
Stefan Haller d19af37ee7 Tell git where the repo is when it can't find it itself
git finds a repo by looking for a .git in the directory a command runs
in. Lazygit runs its commands in the work tree, so that normally works —
but not when the git dir lives somewhere else entirely, which is what
core.worktree and --work-tree are for. Lazygit chdir'd into such a work
tree and then ran commands that couldn't see any repo from there, so
opening a repo with core.worktree set panicked on startup. It only
worked with --git-dir because that leaves GIT_DIR in the environment for
every command to inherit.

Work out at startup whether git can find the repo from its work tree,
and when it can't, put GIT_DIR and GIT_WORK_TREE on every command the
repo's builder produces. As with the working directory the builder pins
(527124d0e0), these also go into the process env — subprocesses don't
come through the builder — but the commands don't read them from there,
because the process env belongs to whichever repo we have switched to
since.

Working out whether git can find the repo means asking git, rather than
reading the .git file, whose contents can spell the same directory
differently than git does. The extra query is skipped for a repo whose
git dir is simply its .git directory, which is nearly all of them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 11:15:01 +02:00
..
bisect Make integration tests using commits more robust 2026-07-09 11:56:27 +02:00
branch Change list section headers to a slightly more elegant design 2026-07-31 08:03:40 +02:00
cherry_pick Change list section headers to a slightly more elegant design 2026-07-31 08:03:40 +02:00
commit Change list section headers to a slightly more elegant design 2026-07-31 08:03:40 +02:00
config Test per-repo side panel config and re-application on repo switch 2026-06-23 14:15:18 +02:00
conflicts Auto-dismiss the continue-rebase prompt when it becomes stale 2026-07-03 18:30:02 +02:00
custom_commands Make integration tests using commits more robust 2026-07-09 11:56:27 +02:00
demo Move the new-worktree keybinding from worktrees to universal 2026-07-03 18:53:05 +02:00
diff Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
file Only prompt to continue a rebase/merge if we started it 2026-07-03 18:28:07 +02:00
filter_and_search Change list section headers to a slightly more elegant design 2026-07-31 08:03:40 +02:00
filter_by_author Make integration tests using commits more robust 2026-07-09 11:56:27 +02:00
filter_by_path When entering a commit in path filtering mode, select the filtered path 2025-10-09 09:58:15 +02:00
interactive_rebase Cancel commit drags with escape 2026-07-31 08:37:28 +02:00
misc Offer direnv .envrc approval from inside lazygit 2026-06-04 09:05:01 +02:00
patch_building Fix multi-selection of files with common prefix not working in commit files panel 2026-07-28 18:14:58 +02:00
reflog Un-deprecate UserConfig.Git.Log.Order and ShowGraph 2025-07-09 13:15:03 +02:00
remote feat: add fork remote command 2025-11-16 17:26:00 +01:00
shared Add merge options menu 2025-10-09 08:45:58 +02:00
shell_commands Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
staging Add RefreshBlockingInput to buffer keypresses until a refresh has landed 2026-07-22 08:31:11 +02:00
stash Fix dropping a range of stashes in filtered mode 2025-08-25 18:41:06 +02:00
status Add backward cycling support for all branches log view 2026-03-08 17:06:17 +01:00
submodule Identify the current and main worktree by git dir, not by path 2026-08-08 11:15:01 +02:00
sync Change list section headers to a slightly more elegant design 2026-07-31 08:03:40 +02:00
tag Fix deleting a remote tag when a remote branch with the same name exists 2025-11-27 19:52:18 +01:00
ui Keep range drags moving at panel edges 2026-07-31 08:32:43 +02:00
undo Switch to branches view when checking out a commit 2025-11-16 21:23:40 +01:00
worktree Tell git where the repo is when it can't find it itself 2026-08-08 11:15:01 +02:00
test_list.go Tell git where the repo is when it can't find it itself 2026-08-08 11:15:01 +02:00
test_list_generator.go Fix typos 2025-01-03 10:50:36 +11:00
tests.go Set working directory in lazygit test command 2024-01-12 19:59:31 +11:00