summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Bandy <bandy.chris@gmail.com>2020-01-25 09:54:44 -0600
committerAdam Stankiewicz <sheerun@sher.pl>2020-01-25 16:54:44 +0100
commit967486dd716de860db3ef091a9dcb9cb65023534 (patch)
tree8c2eef92a124e4697ebe5aac1b01d9c2eff674ec
parente8454d66ab8376cf9c7e42f09749d5bd17d98f89 (diff)
downloadvim-polyglot-967486dd716de860db3ef091a9dcb9cb65023534.tar.gz
vim-polyglot-967486dd716de860db3ef091a9dcb9cb65023534.zip
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.
-rwxr-xr-xbuild10
1 files changed, 7 insertions, 3 deletions
diff --git a/build b/build
index 6ef3f5fd..3b87675c 100755
--- a/build
+++ b/build
@@ -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