From 5c3268c9afb08e345d204d05b977f24cedee52d1 Mon Sep 17 00:00:00 2001 From: Jeffrey 'jf' Lim Date: Wed, 8 Jan 2020 16:40:48 +0800 Subject: [PATCH] libexec/rbenv-version{,-origin}: fix earlier commit to allow for RBENV_VERSION env var --- libexec/rbenv-version | 8 ++++---- libexec/rbenv-version-origin | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libexec/rbenv-version b/libexec/rbenv-version index 60922b69..f968cd1f 100755 --- a/libexec/rbenv-version +++ b/libexec/rbenv-version @@ -8,9 +8,9 @@ set -e [ -n "$RBENV_DEBUG" ] && set -x -RBENV_VERSION_FILE="$(rbenv-version-origin)" -if [ -e "$RBENV_VERSION_FILE" ]; then - echo "$(rbenv-version-name) (set by $RBENV_VERSION_FILE)" -else +RBENV_VERSION_ORIGIN="$(rbenv-version-origin)" +if [ -z "$RBENV_VERSION_ORIGIN" ]; then echo "$(rbenv-version-name)" +else + echo "$(rbenv-version-name) (set by $RBENV_VERSION_ORIGIN)" fi diff --git a/libexec/rbenv-version-origin b/libexec/rbenv-version-origin index 3f1d4f03..139d8157 100755 --- a/libexec/rbenv-version-origin +++ b/libexec/rbenv-version-origin @@ -17,5 +17,8 @@ if [ -n "$RBENV_VERSION_ORIGIN" ]; then elif [ -n "$RBENV_VERSION" ]; then echo "RBENV_VERSION environment variable" else - rbenv-version-file + RBENV_VERSION_FILE="$(rbenv-version-file)" + if [ -e "$RBENV_VERSION_FILE" ]; then + echo $RBENV_VERSION_FILE + fi fi