jesseduffield.lazygit/pkg/integration/components
Stefan Haller 880064b987 Use the isolated test env for shell commands
Shell.RunShellCommand was passing os.Environ() to its child, while its
sibling runCommandWithOutputAndEnv has used the minimal
NewTestEnvironment since late 2023 when env isolation was introduced;
the sh path was just missed.

This matters when integration tests run from inside a `git rebase -x`
exec in a linked worktree: git sets GIT_DIR=<main>/.git/worktrees/<name>
for the exec, and it leaks all the way down through bash, just, go test,
and the test process, into every git invocation RunShellCommand spawns.
cmd.Dir becomes irrelevant — git resolves GIT_DIR over cwd-based
discovery, with the work-tree taken from the gitdir file (i.e. the
worktree root). So `git checkout -b conflict` in a test fixture creates
the branch on the real worktree and switches its HEAD, hijacking the
in-progress rebase and trashing the working tree. (In the main worktree
git doesn't set GIT_DIR for rebase exec, which is why the bug was only
visible from linked worktrees.)

Using self.env also incidentally restores GIT_CONFIG_GLOBAL for shell
commands, so commits made via RunShellCommand are now authored by the
test config's CI identity rather than whatever the host's ~/.gitconfig
resolves to.
2026-05-25 15:18:18 +02:00
..
alert_driver.go Support matchers on integers in integration tests 2023-06-03 15:32:23 +10:00
assertion_helper.go Remove retry logic in integration tests 2023-07-09 20:57:18 +10:00
commit_description_panel_driver.go Change keybinding syntax to spell out full modifier names, and use + instead of - 2026-04-30 22:38:53 +02:00
commit_message_panel_driver.go Improve and adapt commit persistence test-cases 2025-02-07 09:28:27 +01:00
common.go Mention which command is continued in PromptToContinueRebase 2025-04-20 15:53:17 +02:00
confirmation_driver.go Add demo for amending old commit 2023-08-02 22:32:51 +10:00
env.go Disable gh telemetry when running integration tests 2026-05-05 18:42:28 +02:00
file_system.go Allow chaining of FileSystem methods 2025-04-09 10:27:57 +02:00
git.go Add integration test that accesses commit properties in a custom command 2024-04-12 08:33:47 +02:00
int_matcher.go Add integration tests for searching/filtering 2023-07-03 12:54:14 +10:00
matcher.go Support matchers on integers in integration tests 2023-06-03 15:32:23 +10:00
menu_driver.go Add separate keybindings for confirmMenu and confirmSuggestion 2025-09-05 10:42:04 +02:00
paths.go Rename test/results to test/_results 2023-09-15 18:04:20 +02:00
popup.go Refactor: add a separate Prompt view 2025-09-05 10:42:03 +02:00
prompt_driver.go Add separate keybindings for confirmMenu and confirmSuggestion 2025-09-05 10:42:04 +02:00
random.go Add commit graph demo 2023-08-12 16:16:03 +10:00
runner.go Modernize all codes 2025-11-15 10:46:23 +01:00
search_driver.go Change keybinding syntax to spell out full modifier names, and use + instead of - 2026-04-30 22:38:53 +02:00
shell.go Use the isolated test env for shell commands 2026-05-25 15:18:18 +02:00
test.go Refactor repo_paths.go to use git rev-parse 2024-01-24 08:40:01 +01:00
test_driver.go pkg: fix some typos 2024-04-20 13:47:39 +02:00
test_test.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
text_matcher.go [DATALAD RUNCMD] run codespell throughout fixing typos automagically 2024-08-27 18:03:00 +02:00
view_driver.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
views.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00