X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-sh-setup.sh;h=dcf9d0a31030ce4b6a7e7f2268ed8d25fdb57322;hb=ad336054068074ed614d0bb54bb169e5263499d7;hp=c41c2f7439724adc3dd13b92c86b25d254fc23b8;hpb=00d3278c8534a8244ae3447189401111e017fd5d;p=git.git diff --git a/git-sh-setup.sh b/git-sh-setup.sh index c41c2f743..dcf9d0a31 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -99,19 +99,20 @@ set_reflog_action() { } git_editor() { - : "${GIT_EDITOR:=$(git config core.editor)}" - : "${GIT_EDITOR:=${VISUAL:-${EDITOR}}}" - case "$GIT_EDITOR,$TERM" in - ,dumb) - echo >&2 "No editor specified in GIT_EDITOR, core.editor, VISUAL," - echo >&2 "or EDITOR. Tried to fall back to vi but terminal is dumb." - echo >&2 "Please set one of these variables to an appropriate" - echo >&2 "editor or run $0 with options that will not cause an" - echo >&2 "editor to be invoked (e.g., -m or -F for git-commit)." - exit 1 - ;; - esac - eval "${GIT_EDITOR:=vi}" '"$@"' + if test -z "${GIT_EDITOR:+set}" + then + GIT_EDITOR="$(git var GIT_EDITOR)" || return $? + fi + + eval "$GIT_EDITOR" '"$@"' +} + +sane_grep () { + GREP_OPTIONS= LC_ALL=C grep "$@" +} + +sane_egrep () { + GREP_OPTIONS= LC_ALL=C egrep "$@" } is_bare_repository () { @@ -136,7 +137,7 @@ cd_to_toplevel () { } require_work_tree () { - test $(git rev-parse --is-inside-work-tree) = true || + test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true || die "fatal: $0 cannot be used without a working tree." }