mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
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. |
||
|---|---|---|
| .. | ||
| alert_driver.go | ||
| assertion_helper.go | ||
| commit_description_panel_driver.go | ||
| commit_message_panel_driver.go | ||
| common.go | ||
| confirmation_driver.go | ||
| env.go | ||
| file_system.go | ||
| git.go | ||
| int_matcher.go | ||
| matcher.go | ||
| menu_driver.go | ||
| paths.go | ||
| popup.go | ||
| prompt_driver.go | ||
| random.go | ||
| runner.go | ||
| search_driver.go | ||
| shell.go | ||
| test.go | ||
| test_driver.go | ||
| test_test.go | ||
| text_matcher.go | ||
| view_driver.go | ||
| views.go | ||