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