summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-03 16:12:45 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-03 23:15:32 -0700
commit1017e90e4b117df5871fe6447fb6587a5bd98cb5 (patch)
treeae248f95a442f4d710c357d4dd39a4890666b152 /bin
parent37815c8bda4a88df6103d68e1b117a68bd24da19 (diff)
downloaddotfiles-1017e90e4b117df5871fe6447fb6587a5bd98cb5.tar.gz
speed up hstow's restowing, restow in post_update actions
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bstraph2
-rwxr-xr-xbin/hstow12
2 files changed, 11 insertions, 3 deletions
diff --git a/bin/bstraph b/bin/bstraph
index 972662cc..b621aa24 100755
--- a/bin/bstraph
+++ b/bin/bstraph
@@ -34,7 +34,7 @@ for f in gpg.conf gpg-agent.conf dirmngr.conf .gpg-v21-migrated; do
[ -h "$HOME/.gnupg/$f" ] || rm -f "$HOME/.gnupg/$f"
done
-bin/hstow stow .
+bin/hstow restow .
if command -v git >/dev/null; then
# Use a rebase workflow as I'm the only committer.
diff --git a/bin/hstow b/bin/hstow
index 1c640425..5fb58a3a 100755
--- a/bin/hstow
+++ b/bin/hstow
@@ -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