Skip to content

Commit

Permalink
Fix discovering .ruby-version files in root directory
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mislav committed Jun 9, 2015
1 parent 5b9e4f0 commit 43b28ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libexec/rbenv-version-file
Expand Up @@ -5,14 +5,15 @@ 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
elif [ -e "${root}/.rbenv-version" ]; then
echo "${root}/.rbenv-version"
exit
fi
[ -n "$root" ] || break
root="${root%/*}"
done
}
Expand Down

0 comments on commit 43b28ca

Please sign in to comment.