From 5c1094adb9f119f14820bc8ab408f911a7d85f3d Mon Sep 17 00:00:00 2001 From: kou1okada Date: Thu, 9 Jan 2014 15:31:29 +0900 Subject: [PATCH] Response enhancement for in the case of the working directory under the UNC path. finding_local_version_file is extremely slow, when working directory is under the UNC path. Because //host/.rbenv-version and //.rbenv-version do not exist, but testing them is so slow. It's the reason to make a serious delay of the response, when the Ruby runs with a current working directory under the UNC path under Cygwin environment. A response of before applying this patch. //somehost/somedir $ time ruby -e "exit" real 0m13.922s user 0m0.168s sys 0m0.287s A response of after applying this patch. //somehost/somedir $ time ruby -e "exit" real 0m0.721s user 0m0.153s sys 0m0.319s --- libexec/rbenv-version-file | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rbenv-version-file b/libexec/rbenv-version-file index 2413834f..f1cfbd2a 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 [[ -n "$root" && ! "$root" =~ ^//[^/]*$ ]]; do if [ -e "${root}/.ruby-version" ]; then echo "${root}/.ruby-version" exit