From a2384472db57c319f58090db09c26ded810b97bc Mon Sep 17 00:00:00 2001 From: Daniel Hines Date: Mon, 22 Jan 2024 17:51:48 -0500 Subject: [PATCH] git: use $EDITOR when not config.editor is absent --- src/git/config.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/git/config.rs b/src/git/config.rs index 30784ec..419912d 100644 --- a/src/git/config.rs +++ b/src/git/config.rs @@ -38,9 +38,12 @@ impl GitConfig { .get_string("user.name") .map_err(|_| println!("name not found in configuration"))?; - let editor = config - .get_string("core.editor") - .map_err(|_| println!("editor not found in configuration"))?; + let editor = (match config.get_string("core.editor") { + Ok(editor) => Ok(editor), + Err(_) => { + std::env::var("EDITOR").map_err(|_| println!("editor not found in configuration")) + } + })?; // Force rewriteRef = "refs/notes/commits" to exist let rewrite_ref = config