radicle/profile: No pager from Git on Windows
Git for Windows horribly mangles the configured binaries through a POSIX `sh`-like environment even on Windows. We might be able to figure out which `sh.exe` we would have to execute on Windows, but this is too brittle. Windows users will have to use other mechanisms (like `$EDITOR` and `$PAGER`) to configure their programs.
This commit is contained in:
parent
930ec175f1
commit
8fb2d96b5c
|
|
@ -211,11 +211,16 @@ fn default_editor() -> Option<OsString> {
|
|||
return Some(editor.into());
|
||||
}
|
||||
}
|
||||
|
||||
// Check Git. The user might have configured their editor there.
|
||||
#[cfg(feature = "git2")]
|
||||
// On Windows, custom editors configured via Git are not supported,
|
||||
// because of the complexity surrounding how the editor command is
|
||||
// parsed and executed. See also <https://stackoverflow.com/a/773973/1835188>.
|
||||
#[cfg(all(feature = "git2", not(windows)))]
|
||||
if let Ok(path) = git2::Config::open_default().and_then(|cfg| cfg.get_path("core.editor")) {
|
||||
return Some(path.into_os_string());
|
||||
}
|
||||
|
||||
// On macOS, `nano` is installed by default and it's what most users are used to
|
||||
// in the terminal.
|
||||
if cfg!(target_os = "macos") && exists("nano") {
|
||||
|
|
|
|||
|
|
@ -88,6 +88,10 @@ pub mod env {
|
|||
|
||||
/// Get the configured pager program from the environment.
|
||||
pub fn pager() -> Option<String> {
|
||||
// On Windows, custom pagers configured via Git are not supported,
|
||||
// because of the complexity surrounding how the pager command is
|
||||
// parsed and executed. See also <https://stackoverflow.com/a/773973/1835188>.
|
||||
#[cfg(not(windows))]
|
||||
if let Ok(cfg) = crate::git::raw::Config::open_default() {
|
||||
if let Ok(pager) = cfg.get_string("core.pager") {
|
||||
return Some(pager);
|
||||
|
|
|
|||
Loading…
Reference in New Issue