Merge 6375e4ed79dc584a8174e5816d68a1c31b6d9b27 into 06413631029de32cd9af15b6b7f6ed77743cbd79

This commit is contained in:
Jahir Raihan Joy 2024-11-14 14:05:25 +08:00 committed by GitHub
commit 07677be324
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

12
nvm.sh
View File

@ -440,6 +440,7 @@ else
fi
unset NVM_SCRIPT_SOURCE 2>/dev/null
nvm_tree_contains_path() {
local tree
tree="${1-}"
@ -455,14 +456,21 @@ nvm_tree_contains_path() {
previous_pathdir="${node_path}"
local pathdir
pathdir=$(dirname "${previous_pathdir}")
# Convert tree path to canonical form for case-insensitive comparison
local tree_canonical
tree_canonical=$(cd "${tree}" && pwd -P)
while [ "${pathdir}" != '' ] && [ "${pathdir}" != '.' ] && [ "${pathdir}" != '/' ] &&
[ "${pathdir}" != "${tree}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
[ "${pathdir}" != "${tree_canonical}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
previous_pathdir="${pathdir}"
pathdir=$(dirname "${previous_pathdir}")
done
[ "${pathdir}" = "${tree}" ]
[ "${pathdir}" = "${tree_canonical}" ]
}
nvm_find_project_dir() {
local path_
path_="${PWD}"