fix resolving symlinks in rbenv-hooks
This commit is contained in:
parent
a81ace2ccb
commit
ea3203dbab
@ -25,7 +25,6 @@ resolve_link() {
|
|||||||
|
|
||||||
realpath() {
|
realpath() {
|
||||||
local cwd="$(pwd)"
|
local cwd="$(pwd)"
|
||||||
local base="$(basename $1)"
|
|
||||||
local path="$1"
|
local path="$1"
|
||||||
|
|
||||||
while [ -n "$path" ]; do
|
while [ -n "$path" ]; do
|
||||||
@ -34,7 +33,7 @@ realpath() {
|
|||||||
path="$(resolve_link "$name" || true)"
|
path="$(resolve_link "$name" || true)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$(pwd)/$base"
|
echo "$(pwd)/$name"
|
||||||
cd "$cwd"
|
cd "$cwd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,3 +36,14 @@ create_hook() {
|
|||||||
RBENV_HOOK_PATH="${HOME}/../rbenv.d" run rbenv-hooks exec
|
RBENV_HOOK_PATH="${HOME}/../rbenv.d" run rbenv-hooks exec
|
||||||
assert_success "${RBENV_TEST_DIR}/rbenv.d/exec/hello.bash"
|
assert_success "${RBENV_TEST_DIR}/rbenv.d/exec/hello.bash"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "resolves symlinks" {
|
||||||
|
path="${RBENV_TEST_DIR}/rbenv.d"
|
||||||
|
mkdir -p "${path}/exec"
|
||||||
|
mkdir -p "$HOME"
|
||||||
|
touch "${HOME}/hola.bash"
|
||||||
|
ln -s "../../home/hola.bash" "${path}/exec/hello.bash"
|
||||||
|
|
||||||
|
RBENV_HOOK_PATH="$path" run rbenv-hooks exec
|
||||||
|
assert_success "${HOME}/hola.bash"
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user