Fix discovering .ruby-version files in root directory

It's not that this is a preferred way to set a global version (one
should use `rbenv global <version>` instead), but this fixes the
function purely for correctness: all parent directories should be
scanned, even the root directory.

Fixes #745
This commit is contained in:
Mislav Marohnić 2015-06-09 17:24:15 +02:00
parent 5b9e4f0584
commit 43b28caa94

View 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
}