Combine ftdetect files in a predictable order (#461)

Bash expands patterns to an alphabetically sorted list of filenames, but
the order depends on LC_COLLATE. On both Linux and BSD, `sort -V` uses
the C locale.
This commit is contained in:
Chris Bandy
2020-01-25 09:54:44 -06:00
committed by Adam Stankiewicz
parent e8454d66ab
commit 967486dd71

10
build
View File

@@ -72,8 +72,11 @@ extract() {
continue
fi
[ -d "${dir}${subtree:-/}ftdetect" ] && for f in "${dir}${subtree:-/}ftdetect/"*; do
cat <<EOF >> tmp/polyglot.vim
ftdetect=("${dir}${subtree:-/}ftdetect"/*)
if [ "$ftdetect" ] && [ "$ftdetect" != "${dir}${subtree:-/}ftdetect/*" ]; then
IFS=$'\n' ftdetect=($(sort -V <<< "${ftdetect[*]}")); unset IFS
for f in "${ftdetect[@]}"; do
cat <<EOF >> tmp/polyglot.vim
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '${pack%%:*}') == -1
augroup filetypedetect
" ${pack%%:*}, from ${f##*/ftdetect/} in ${pack#*:}
@@ -82,7 +85,8 @@ $(cat "${f}")
endif
EOF
done
done
fi
done