From 472be778aa9f5725f3a7757baa5c791b32182f2c Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 5 Aug 2016 02:44:29 +0300 Subject: [PATCH] Use `git var GIT_EDITOR` to call editor `git var GIT_EDITOR` is better than ${VISUAL:-${EDITOR:-vi}} because it takes into account all variables: GIT_EDITOR, VISUAL and EDITOR, and falls back to the platform's default. --- clone2current | 2 +- edit-description | 2 +- publish2web | 2 +- svn/svn2git | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clone2current b/clone2current index 4927783..92590b9 100755 --- a/clone2current +++ b/clone2current @@ -25,7 +25,7 @@ cd "$dest_dir" && if [ "`cat \"$source_dir\"/.git/description`" = \ "Unnamed repository; edit this file 'description' to name the repository." ] then - "${VISUAL:-${EDITOR:-vi}}" "$source_dir"/.git/description .git/description + `git var GIT_EDITOR` "$source_dir"/.git/description .git/description else cp -p "$source_dir"/.git/description .git fi && diff --git a/edit-description b/edit-description index 547b248..3311bb9 100755 --- a/edit-description +++ b/edit-description @@ -2,4 +2,4 @@ exec "`dirname \"$0\"`"/do-all \ 'test "`cat $g/description`" = "Unnamed repository; edit this file '"'"description"'"' to name the repository." && - "${VISUAL:-${EDITOR:-vi}}" "$g"/description < /dev/tty' + `git var GIT_EDITOR` "$g"/description < /dev/tty' diff --git a/publish2web b/publish2web index b7bd785..1847f7a 100755 --- a/publish2web +++ b/publish2web @@ -26,7 +26,7 @@ cp -p "$HOME"/Internet/WWW/htdocs/git.phdru.name/phdru.name/phdru.name.git/git-d if [ "`cat \"$source_dir\"/.git/description`" = \ "Unnamed repository; edit this file 'description' to name the repository." ] then - "${VISUAL:-${EDITOR:-vi}}" "$source_dir"/.git/description description + `git var GIT_EDITOR` "$source_dir"/.git/description description else cp -p "$source_dir"/.git/description . && chmod a+r description fi && diff --git a/svn/svn2git b/svn/svn2git index dde280f..5c68c17 100755 --- a/svn/svn2git +++ b/svn/svn2git @@ -58,4 +58,4 @@ git svn gc && git gc --aggressive && git repack -a -d -f --depth=20 --window=250 && echo "Cloned from $url using git-svn" >.git/description && -exec "${VISUAL:-${EDITOR:-vi}}" .git/description +exec `git var GIT_EDITOR` .git/description -- 2.39.5