1
0
Fork 0
mirror of synced 2024-12-21 22:21:08 -05:00

Standardize sort order

Prevent localizations from interfering with sorting order.
This commit is contained in:
Tim Byrne 2019-04-05 08:02:42 -05:00
parent 0c6be5e398
commit 2375a0955b
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12
2 changed files with 3 additions and 4 deletions

View file

@ -166,7 +166,6 @@ def run_parse_encrypt(
export YADM_ENCRYPT export YADM_ENCRYPT
GIT_DIR={paths.repo} GIT_DIR={paths.repo}
export GIT_DIR export GIT_DIR
LC_ALL=C
{parse_cmd} {parse_cmd}
export ENCRYPT_INCLUDE_FILES export ENCRYPT_INCLUDE_FILES
export PARSE_ENCRYPT_SHORT export PARSE_ENCRYPT_SHORT

6
yadm
View file

@ -182,7 +182,7 @@ function alt() {
last_linked='' last_linked=''
local IFS=$'\n' local IFS=$'\n'
# the alt_paths looped over here are a unique sorted list of both files and their immediate parent directory # the alt_paths looped over here are a unique sorted list of both files and their immediate parent directory
for alt_path in $(for tracked in $("$GIT_PROGRAM" ls-files); do printf "%s\n" "$tracked" "${tracked%/*}"; done | sort -u) "${ENCRYPT_INCLUDE_FILES[@]}"; do for alt_path in $(for tracked in $("$GIT_PROGRAM" ls-files); do printf "%s\n" "$tracked" "${tracked%/*}"; done | LC_ALL=C sort -u) "${ENCRYPT_INCLUDE_FILES[@]}"; do
alt_path="$YADM_WORK/$alt_path" alt_path="$YADM_WORK/$alt_path"
if [ -e "$alt_path" ] ; then if [ -e "$alt_path" ] ; then
if [[ $alt_path =~ $match ]] ; then if [[ $alt_path =~ $match ]] ; then
@ -209,7 +209,7 @@ function alt() {
# for every file which is a *##yadm.j2 create a real file # for every file which is a *##yadm.j2 create a real file
local IFS=$'\n' local IFS=$'\n'
local match="^(.+)##yadm\\.j2$" local match="^(.+)##yadm\\.j2$"
for tracked_file in $("$GIT_PROGRAM" ls-files | sort) "${ENCRYPT_INCLUDE_FILES[@]}"; do for tracked_file in $("$GIT_PROGRAM" ls-files | LC_ALL=C sort) "${ENCRYPT_INCLUDE_FILES[@]}"; do
tracked_file="$YADM_WORK/$tracked_file" tracked_file="$YADM_WORK/$tracked_file"
if [ -e "$tracked_file" ] ; then if [ -e "$tracked_file" ] ; then
if [[ $tracked_file =~ $match ]] ; then if [[ $tracked_file =~ $match ]] ; then
@ -957,7 +957,7 @@ function parse_encrypt() {
# sort the encrypted files # sort the encrypted files
#shellcheck disable=SC2207 #shellcheck disable=SC2207
IFS=$'\n' ENCRYPT_INCLUDE_FILES=($(sort <<<"${FINAL_INCLUDE[*]}")) IFS=$'\n' ENCRYPT_INCLUDE_FILES=($(LC_ALL=C sort <<<"${FINAL_INCLUDE[*]}"))
unset IFS unset IFS
fi fi