From a981ef40e84398475cfe04ac49b8118385249a96 Mon Sep 17 00:00:00 2001 From: Campbell Jones Date: Sat, 25 Mar 2023 17:53:27 -0400 Subject: edit: improve editor presence checking Adds a check for the configured Git editor (git config core.editor) in both commitpkg and build.sh. Additionally, instead of blindly executing vi when all other options are exhausted, remove it instead as it is a none standard installed editor anyway. Closes #106 Signed-off-by: Levente Polyak --- src/commitpkg.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/commitpkg.in') diff --git a/src/commitpkg.in b/src/commitpkg.in index 7573d9b..26117dc 100644 --- a/src/commitpkg.in +++ b/src/commitpkg.in @@ -198,8 +198,10 @@ if [[ -n $(git status --short --untracked-files=no) ]]; then $VISUAL "$msgfile" || die elif [[ -n $EDITOR ]]; then $EDITOR "$msgfile" || die + elif giteditor=$(git config --get core.editor); then + $giteditor "$msgfile" || die else - vi "$msgfile" || die + die "No usable editor found (tried \$GIT_EDITOR, \$VISUAL, \$EDITOR, git config [core.editor])." fi [[ -s $msgfile ]] || die stat_busy 'Committing changes' -- cgit v1.2.3-54-g00ecf