From 71a916faf2ff9a77b541d3ac02110c706ac110a6 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Mon, 6 Jan 2014 16:37:21 +0900 Subject: [PATCH] simplicy the check for infinite loop --- libexec/pyenv-version-file | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/pyenv-version-file b/libexec/pyenv-version-file index b6b2fa35..d7f5a228 100755 --- a/libexec/pyenv-version-file +++ b/libexec/pyenv-version-file @@ -4,8 +4,8 @@ set -e [ -n "$PYENV_DEBUG" ] && set -x find_local_version_file() { - local prev root="$1" - while [ -n "$root" ] && [ "$root" != "$prev" ]; do + local root="$1" + while [ -n "$root" ]; do if [ -e "${root}/.python-version" ]; then echo "${root}/.python-version" exit @@ -13,7 +13,7 @@ find_local_version_file() { echo "${root}/.pyenv-version" exit fi - prev="${root}" + [ "${root}" = "${root%/*}" ] && break root="${root%/*}" done }