diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-12-03 16:12:45 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-12-03 23:15:32 -0700 |
commit | 1017e90e4b117df5871fe6447fb6587a5bd98cb5 (patch) | |
tree | ae248f95a442f4d710c357d4dd39a4890666b152 /bin/hstow | |
parent | 37815c8bda4a88df6103d68e1b117a68bd24da19 (diff) | |
download | dotfiles-1017e90e4b117df5871fe6447fb6587a5bd98cb5.tar.gz |
speed up hstow's restowing, restow in post_update actions
Diffstat (limited to 'bin/hstow')
-rwxr-xr-x | bin/hstow | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -131,9 +131,17 @@ stow () { unstow () { cd "$HOME" - dir_pat="^\.$(echo $DIR | cut -c$(echo $HOME|wc -m|tr -d ' ')-)/" + + # For speed, skip directories into which we'll never stow anything. + ignores="$([ -e "$DIR/.hstow-unstow-ignore" ] || exit 0 + while read -r line; do + printf "|./%s/" "$line" + done <"$DIR/.hstow-unstow-ignore")" + + dir_pat=".$(echo $DIR | cut -c$(echo $HOME | wc -m | tr -d ' ')-)/" + dirs_pat="$(echo "^($dir_pat$ignores)" | sed -e 's#\.#\\.#g')" for file in $(find . -type l ! -name . ! -name "$cchars" \ - | grep -v "$dir_pat"); do + | grep -Ev "$dirs_pat"); do if readlink "$file" | grep -Eq '^(\.\./)*\.STOW/'"$NAME/"; then rm "$file" while true; do |