| @@ -30,7 +30,7 @@ pub fn installation_config_prefix() -> Option<&'static Path> { · 29 unmodified lines |
| 30 | | 30 | |
| 31 | /// Return the shell that Git would use, the shell to execute commands from. | 31 | /// Return the shell that Git would use, the shell to execute commands from. |
| 32 | /// | 32 | /// |
| 33 | /// On Windows, this is the full path to `sh.exe` bundled with it, and on | 33 | /// On Windows, this is the full path to `sh.exe` bundled with Git, and on |
| 34 | /// Unix it's `/bin/sh` as posix compatible shell. | 34 | /// Unix it's `/bin/sh` as posix compatible shell. |
| 35 | /// If the bundled shell on Windows cannot be found, `sh` is returned as the name of a shell | 35 | /// If the bundled shell on Windows cannot be found, `sh` is returned as the name of a shell |
| 36 | /// as it could possibly be found in `PATH`. | 36 | /// as it could possibly be found in `PATH`. |
| @@ -39,7 +39,7 @@ pub fn shell() -> &'static OsStr { · 2 unmodified lines |
| 39 | static PATH: Lazy<OsString> = Lazy::new(|| { | 39 | static PATH: Lazy<OsString> = Lazy::new(|| { |
| 40 | if cfg!(windows) { | 40 | if cfg!(windows) { |
| 41 | core_dir() | 41 | core_dir() |
| 42 | .and_then(|p| p.ancestors().nth(3) /* skip mingw64/libexec/git-core */) | 42 | .and_then(|p| p.ancestors().nth(3)) // Skip something like mingw64/libexec/git-core. |
| 43 | .map(|p| p.join("usr").join("bin").join("sh.exe")) | 43 | .map(|p| p.join("usr").join("bin").join("sh.exe")) |
| 44 | .map_or_else(|| OsString::from("sh"), Into::into) | 44 | .map_or_else(|| OsString::from("sh"), Into::into) |
| 45 | } else { | 45 | } else { |
| @@ -122,7 +122,7 @@ static GIT_CORE_DIR: Lazy<Option<PathBuf>> = Lazy::new(|| { · 76 unmodified lines |
| 122 | } | 122 | } |
| 123 | | 123 | |
| 124 | BString::new(output.stdout) | 124 | BString::new(output.stdout) |
| 125 | .trim_with(|b| b.is_ascii_whitespace()) | 125 | .strip_suffix(b"\n")? |
| 126 | .to_path() | 126 | .to_path() |
| 127 | .ok()? | 127 | .ok()? |
| 128 | .to_owned() | 128 | .to_owned() |