Skip version aliases while rehashing

Because a version alias points to another version in rbenv, its
executables will get included in the rehash process anyway.

I hoped that this results in rehash speedup because fewer directories
get processed on a system with lots of aliases (I have 9), but the truth
is I didn't witness any speedup. It's likely that the overhead of
`rbenv-versions --skip-aliases` makes up for any performance gain that
we could have had here.
This commit is contained in:
Mislav Marohnić 2014-10-15 07:13:59 +02:00
parent 23083ff9f8
commit f133fda91f

View file

@ -81,9 +81,12 @@ remove_outdated_shims() {
# List basenames of executables for every Ruby version
list_executable_names() {
local file
for file in "$RBENV_ROOT"/versions/*/bin/*; do
echo "${file##*/}"
local version file
rbenv-versions --bare --skip-aliases | \
while read version; do
for file in "${RBENV_ROOT}/versions/${version}/bin/"*; do
echo "${file##*/}"
done
done
}