Give priority to CLASS by processing those patterns separately (#51)

This commit is contained in:
Tim Byrne 2017-03-25 12:55:46 -05:00
parent 297df5d231
commit 5678e383d8
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12
1 changed files with 20 additions and 17 deletions

7
yadm
View File

@ -116,7 +116,7 @@ function alt() {
match_class="$(config local.class)"
if [ -z "$match_class" ] ; then
match_class="()"
match_class="%"
fi
match_class="(%|$match_class)"
@ -140,7 +140,8 @@ function alt() {
match_user="(%|$match_user)"
#; regex for matching "<file>##CLASS.SYSTEM.HOSTNAME.USER"
match="^(.+)##(()|$match_class|$match_system|$match_class\.$match_system|$match_system\.$match_host|$match_class\.$match_system\.$match_host|$match_system\.$match_host\.$match_user|$match_class\.$match_system\.$match_host\.$match_user)$"
match1="^(.+)##(()|$match_system|$match_system\.$match_host|$match_system\.$match_host\.$match_user)$"
match2="^(.+)##($match_class|$match_class\.$match_system|$match_class\.$match_system\.$match_host|$match_class\.$match_system\.$match_host\.$match_user)$"
#; process relative to YADM_WORK
YADM_WORK=$(unix_path "$("$GIT_PROGRAM" config core.worktree)")
@ -170,6 +171,7 @@ function alt() {
#; loop over all "tracked" files
#; for every file which matches the above regex, create a symlink
for match in $match1 $match2; do
last_linked=''
local IFS=$'\n'
for tracked_file in $("$GIT_PROGRAM" ls-files | sort) "${ENC_FILES[@]}"; do
@ -189,6 +191,7 @@ function alt() {
fi
done
done
done
}