Skip to content

Commit

Permalink
git: use $EDITOR when not config.editor is absent
Browse files Browse the repository at this point in the history
  • Loading branch information
d4hines authored and Pilou97 committed Jan 23, 2024
1 parent 95b9495 commit a238447
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/git/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a238447

Please sign in to comment.