Simplify parse_encrypt by exiting early
if encrypt file doesn't exist. Signed-off-by: Ross Smith II <ross@smithii.com>
This commit is contained in:
parent
a5b1067e02
commit
0c788ae020
1 changed files with 42 additions and 39 deletions
9
yadm
9
yadm
|
@ -1871,6 +1871,12 @@ function parse_encrypt() {
|
|||
|
||||
ENCRYPT_INCLUDE_FILES=()
|
||||
ENCRYPT_EXCLUDE_FILES=()
|
||||
FINAL_INCLUDE=()
|
||||
ENCRYPT_INCLUDE_FILES=()
|
||||
|
||||
if [ ! -f "$YADM_ENCRYPT" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd_work "Parsing encrypt" || return
|
||||
|
||||
|
@ -1883,7 +1889,6 @@ function parse_encrypt() {
|
|||
shopt -s globstar &> /dev/null
|
||||
|
||||
exclude_pattern="^!(.+)"
|
||||
if [ -f "$YADM_ENCRYPT" ] ; then
|
||||
# parse both included/excluded
|
||||
while IFS='' read -r line || [ -n "$line" ]; do
|
||||
if [[ ! $line =~ ^# && ! $line =~ ^[[:blank:]]*$ ]] ; then
|
||||
|
@ -1908,7 +1913,6 @@ function parse_encrypt() {
|
|||
|
||||
# remove excludes from the includes
|
||||
#(SC2068 is disabled because in this case, we desire globbing)
|
||||
FINAL_INCLUDE=()
|
||||
#shellcheck disable=SC2068
|
||||
for included in "${ENCRYPT_INCLUDE_FILES[@]}"; do
|
||||
skip=
|
||||
|
@ -1923,7 +1927,6 @@ function parse_encrypt() {
|
|||
#shellcheck disable=SC2207
|
||||
IFS=$'\n' ENCRYPT_INCLUDE_FILES=($(LC_ALL=C sort <<<"${FINAL_INCLUDE[*]}"))
|
||||
unset IFS
|
||||
fi
|
||||
|
||||
if [ "$unset_globstar" = "1" ]; then
|
||||
shopt -u globstar &> /dev/null
|
||||
|
|
Loading…
Reference in a new issue