mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 00:10:41 +08:00

GIT_WORK_TREE is an environment variable which tells git where the worktree is. It may be set by the user or by git itself, e.g. when running `git rebase -i --exec ...`. If it is set, it overrides the working directory, causing the `git checkout` from FetchContent_Populate to fail. Clear this variable. Do the same for GIT_DIR for the same reason. A way to reproduce the failure that this commit fixes is: git rebase -i HEAD^^^ --exec 'ninja -C /path/to/build/dir fish' prior to this commit, using the fetched PCRE2, this would fail in CMake.