diff --git a/libexec/rbenv-version b/libexec/rbenv-version index f968cd1f..c95ab0d3 100755 --- a/libexec/rbenv-version +++ b/libexec/rbenv-version @@ -8,9 +8,11 @@ set -e [ -n "$RBENV_DEBUG" ] && set -x -RBENV_VERSION_ORIGIN="$(rbenv-version-origin)" -if [ -z "$RBENV_VERSION_ORIGIN" ]; then - echo "$(rbenv-version-name)" +version_name="$(rbenv-version-name)" +version_origin="$(rbenv-version-origin)" + +if [ "$version_origin" = "${RBENV_ROOT}/version" ] && [ ! -e "$version_origin" ]; then + echo "$version_name" else - echo "$(rbenv-version-name) (set by $RBENV_VERSION_ORIGIN)" + echo "$version_name (set by $version_origin)" fi diff --git a/libexec/rbenv-version-origin b/libexec/rbenv-version-origin index 139d8157..3f1d4f03 100755 --- a/libexec/rbenv-version-origin +++ b/libexec/rbenv-version-origin @@ -17,8 +17,5 @@ if [ -n "$RBENV_VERSION_ORIGIN" ]; then elif [ -n "$RBENV_VERSION" ]; then echo "RBENV_VERSION environment variable" else - RBENV_VERSION_FILE="$(rbenv-version-file)" - if [ -e "$RBENV_VERSION_FILE" ]; then - echo $RBENV_VERSION_FILE - fi + rbenv-version-file fi