mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 00:26:24 -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. |
||
|---|---|---|
| .. | ||
| app | ||
| cheatsheet | ||
| commands | ||
| common | ||
| config | ||
| constants | ||
| env | ||
| fakes | ||
| gocui | ||
| gui | ||
| i18n | ||
| integration | ||
| jsonschema | ||
| logs | ||
| snake | ||
| tasks | ||
| theme | ||
| updates | ||
| utils | ||