Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle/profile: No pager from Git on Windows
Lorenz Leutgeb committed 2 months ago
commit 8fb2d96b5cdbe629b2e25bb968c76c381b9f2be2
parent 930ec175f14b77fd700f06fdc02b8719282ea5a2
2 files changed +10 -1
modified crates/radicle-term/src/editor.rs
@@ -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") {
modified crates/radicle/src/profile.rs
@@ -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);