| @@ -1,15 +1,13 @@ |
| 1 | use std::path::PathBuf; | 1 | use std::ffi::OsString; |
| 2 | use std::{ | 2 | use std::path::{Path, PathBuf}; |
| 3 | ffi::OsString, | 3 | use std::process::{Command, Stdio}; |
| 4 | path::Path, | | |
| 5 | process::{Command, Stdio}, | | |
| 6 | }; | | |
| 7 | | 4 | |
| 8 | use bstr::{BStr, BString, ByteSlice}; | 5 | use bstr::{BStr, BString, ByteSlice}; |
| | 6 | use once_cell::sync::Lazy; |
| 9 | | 7 | |
| 10 | /// Other places to find Git in. | 8 | /// Other places to find Git in. |
| 11 | #[cfg(windows)] | 9 | #[cfg(windows)] |
| 12 | pub(super) static ALTERNATIVE_LOCATIONS: once_cell::sync::Lazy<Vec<OsString>> = once_cell::sync::Lazy::new(|| { | 10 | pub(super) static ALTERNATIVE_LOCATIONS: Lazy<Vec<OsString>> = Lazy::new(|| { |
| 13 | vec![ | 11 | vec![ |
| 14 | "C:/Program Files/Git/mingw64/bin".into(), | 12 | "C:/Program Files/Git/mingw64/bin".into(), |
| 15 | "C:/Program Files (x86)/Git/mingw32/bin".into(), | 13 | "C:/Program Files (x86)/Git/mingw32/bin".into(), |
| @@ -24,7 +22,7 @@ pub(super) static EXE_NAME: &str = "git.exe"; · 8 unmodified lines |
| 24 | pub(super) static EXE_NAME: &str = "git"; | 22 | pub(super) static EXE_NAME: &str = "git"; |
| 25 | | 23 | |
| 26 | /// Invoke the git executable in PATH to obtain the origin configuration, which is cached and returned. | 24 | /// Invoke the git executable in PATH to obtain the origin configuration, which is cached and returned. |
| 27 | pub(super) static EXE_INFO: once_cell::sync::Lazy<Option<BString>> = once_cell::sync::Lazy::new(|| { | 25 | pub(super) static EXE_INFO: Lazy<Option<BString>> = Lazy::new(|| { |
| 28 | let git_cmd = |executable: PathBuf| { | 26 | let git_cmd = |executable: PathBuf| { |
| 29 | let mut cmd = Command::new(executable); | 27 | let mut cmd = Command::new(executable); |
| 30 | cmd.args(["config", "-l", "--show-origin"]) | 28 | cmd.args(["config", "-l", "--show-origin"]) |
| @@ -55,7 +53,7 @@ pub(super) static EXE_INFO: once_cell::sync::Lazy<Option<BString>> = once_cell:: · 24 unmodified lines |
| 55 | /// if no `git` executable was found or there were other errors during execution. | 53 | /// if no `git` executable was found or there were other errors during execution. |
| 56 | pub(super) fn install_config_path() -> Option<&'static BStr> { | 54 | pub(super) fn install_config_path() -> Option<&'static BStr> { |
| 57 | let _span = gix_trace::detail!("gix_path::git::install_config_path()"); | 55 | let _span = gix_trace::detail!("gix_path::git::install_config_path()"); |
| 58 | static PATH: once_cell::sync::Lazy<Option<BString>> = once_cell::sync::Lazy::new(|| { | 56 | static PATH: Lazy<Option<BString>> = Lazy::new(|| { |
| 59 | // Shortcut: in Msys shells this variable is set which allows to deduce the installation directory, | 57 | // Shortcut: in Msys shells this variable is set which allows to deduce the installation directory, |
| 60 | // so we can save the `git` invocation. | 58 | // so we can save the `git` invocation. |
| 61 | #[cfg(windows)] | 59 | #[cfg(windows)] |