diff --git a/libexec/rbenv-version b/libexec/rbenv-version index d1fefcc5..c95ab0d3 100755 --- a/libexec/rbenv-version +++ b/libexec/rbenv-version @@ -8,4 +8,11 @@ set -e [ -n "$RBENV_DEBUG" ] && set -x -echo "$(rbenv-version-name) (set by $(rbenv-version-origin))" +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 "$version_name (set by $version_origin)" +fi diff --git a/test/version.bats b/test/version.bats index 886d0efa..f75af978 100644 --- a/test/version.bats +++ b/test/version.bats @@ -14,7 +14,7 @@ setup() { @test "no version selected" { assert [ ! -d "${RBENV_ROOT}/versions" ] run rbenv-version - assert_success "system (set by ${RBENV_ROOT}/version)" + assert_success "system" } @test "set by RBENV_VERSION" { diff --git a/test/versions.bats b/test/versions.bats index 3273b375..2c88ee2f 100644 --- a/test/versions.bats +++ b/test/versions.bats @@ -21,7 +21,7 @@ stub_system_ruby() { stub_system_ruby assert [ ! -d "${RBENV_ROOT}/versions" ] run rbenv-versions - assert_success "* system (set by ${RBENV_ROOT}/version)" + assert_success "* system" } @test "not even system ruby available" { @@ -42,7 +42,7 @@ stub_system_ruby() { run rbenv-versions assert_success assert_output <