From 58edf313aae890c60b14ab5acbe1ff555ab31848 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Sun, 24 Mar 2019 17:05:11 -0500 Subject: [PATCH] Process .yadm/encrypt in sorted order --- test/test_unit_parse_encrypt.py | 5 +++++ yadm | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_unit_parse_encrypt.py b/test/test_unit_parse_encrypt.py index 914d907..b1a1af9 100644 --- a/test/test_unit_parse_encrypt.py +++ b/test/test_unit_parse_encrypt.py @@ -140,6 +140,10 @@ def test_file_parse_encrypt(runner, paths): for expected_file in expected: assert f'EIF:{expected_file}\n' in run.out + sorted_expectations = '\n'.join( + [f'EIF:{exp}' for exp in sorted(expected)]) + assert sorted_expectations in run.out + def run_parse_encrypt( runner, paths, @@ -162,6 +166,7 @@ def run_parse_encrypt( export YADM_ENCRYPT GIT_DIR={paths.repo} export GIT_DIR + LC_ALL=C {parse_cmd} export ENCRYPT_INCLUDE_FILES export PARSE_ENCRYPT_SHORT diff --git a/yadm b/yadm index e57551f..49d9302 100755 --- a/yadm +++ b/yadm @@ -956,7 +956,11 @@ function parse_encrypt() { done [ -n "$skip" ] || FINAL_INCLUDE+=("$included") done - ENCRYPT_INCLUDE_FILES=("${FINAL_INCLUDE[@]}") + + #; sort the encrypted files + #shellcheck disable=SC2207 + IFS=$'\n' ENCRYPT_INCLUDE_FILES=($(sort <<<"${FINAL_INCLUDE[*]}")) + unset IFS fi }