diff --git a/libexec/rbenv-version-file b/libexec/rbenv-version-file index 2413834f2b..7a2b9c6e0a 100755 --- a/libexec/rbenv-version-file +++ b/libexec/rbenv-version-file @@ -5,7 +5,7 @@ set -e find_local_version_file() { local root="$1" - while [ -n "$root" ]; do + while true; do if [ -e "${root}/.ruby-version" ]; then echo "${root}/.ruby-version" exit @@ -13,6 +13,7 @@ find_local_version_file() { echo "${root}/.rbenv-version" exit fi + [ -n "$root" ] || break root="${root%/*}" done }