That was just added in the previous commit. `installation_config()` and `installation_config_prefix()` should never use, as their only strategy, the technique implemented in the newly introduced `git_for_windows_root()` helper, because if the system-scope configuration file is present elsewhere, including due to `GIT_CONFIG_SYSTEM` being set, then that *should* affect the values returned by those functions (except on Apple Git and any other systems where a separate higher "unknown" scope exists and is typically nonempty). Rather, some uses of `installation_config_prefix()`, such as to find other files that are better looked for relative to installed non-configuration files or installation directory itself rather than relative to its configuration file, might in the future be suitable to look fo9r using `git_for_windows_root()`.
Unified · Split
| @@ -44,16 +44,7 @@ const MSYS_USR_VARIANTS: &[&str] = &["mingw64", "mingw32", "clangarm64", "clang6 · 43 unmodified lines | ||
| 44 | 44 | /// Find a Git for Windows installation directory based on `git --exec-path` output. |
| 45 | 45 | /// |
| 46 | 46 | /// Currently this is used only for finding the path to an `sh.exe` associated with Git. This is |
| 47 | −/// separate from `installation_config()` and `installation_config_prefix()` in `gix_path::env`, | |
| 48 | −/// which guess where `etc/gitconfig` is based on `EXEPATH` or the location of the highest-scope | |
| 49 | −/// config file. | |
| 50 | −/// | |
| 51 | −/// The techniques might be combined or unified in some way in the future. The techniques those | |
| 52 | −/// functions currently use shouldn't be used to find `sh.exe`, because `EXEPATH` can take on other | |
| 53 | −/// values in some environments, and the highest scope config file may be unavailable or in another | |
| 54 | −/// location if `GIT_CONFIG_SYSTEM` or `GIT_CONFIG_NOSYSTEM` are set or if there are no variables | |
| 55 | −/// of system scope. Then paths found relative to it could be different. In contrast, the technique | |
| 56 | −/// used here may be usable for those functions, though may need to cover more directory layouts. | |
| 47 | +/// separate from `installation_config()` and `installation_config_prefix()` in `gix_path::env`. | |
| 57 | 48 | fn git_for_windows_root() -> Option<&'static Path> { |
| 58 | 49 | static GIT_ROOT: Lazy<Option<PathBuf>> = Lazy::new(|| { |
| 59 | 50 | super::core_dir() |