summaryrefslogtreecommitdiff
path: root/yadm
diff options
context:
space:
mode:
authorTim Byrne <sultan@locehilios.com>2019-11-26 16:24:51 -0600
committerTim Byrne <sultan@locehilios.com>2019-11-26 16:24:51 -0600
commit510169eb7fc0e93998c55a91636390a7186d2666 (patch)
tree37425ea1e2feab793aff1a2a232f38b545ac318f /yadm
parent24e6e817130d1c4d67151280b1e031884910a645 (diff)
Support double-star globs in encrypt (#109)
This will only work for Bash >=4, there the shell option "globstar" is supported.
Diffstat (limited to 'yadm')
-rwxr-xr-xyadm12
1 files changed, 12 insertions, 0 deletions
diff --git a/yadm b/yadm
index dd63f78..331fa64 100755
--- a/yadm
+++ b/yadm
@@ -1545,6 +1545,14 @@ function parse_encrypt() {
cd_work "Parsing encrypt" || return
+ # setting globstar to allow ** in encrypt patterns
+ # (only supported on Bash >= 4)
+ local unset_globstar
+ if ! shopt globstar &>/dev/null; then
+ unset_globstar=1
+ fi
+ shopt -s globstar &>/dev/null
+
exclude_pattern="^!(.+)"
if [ -f "$YADM_ENCRYPT" ] ; then
# parse both included/excluded
@@ -1588,6 +1596,10 @@ function parse_encrypt() {
unset IFS
fi
+ if [ "$unset_globstar" = "1" ]; then
+ shopt -u globstar &>/dev/null
+ fi
+
}
function builtin_dirname() {