summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hstow-unstow-ignore8
-rwxr-xr-xbin/bstraph2
-rwxr-xr-xbin/hstow12
-rw-r--r--lib-src/mr/config8
4 files changed, 21 insertions, 9 deletions
diff --git a/.hstow-unstow-ignore b/.hstow-unstow-ignore
new file mode 100644
index 00000000..524e153f
--- /dev/null
+++ b/.hstow-unstow-ignore
@@ -0,0 +1,8 @@
+annex
+doc
+Downloads
+.fmail
+local
+mnt
+src
+tmp
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
diff --git a/lib-src/mr/config b/lib-src/mr/config
index d10504f0..19d18e8c 100644
--- a/lib-src/mr/config
+++ b/lib-src/mr/config
@@ -128,10 +128,6 @@ pre_push =
git rebase master
fi
fi
-# Restowing is expensive, and most dangling symlinks into ~/.STOW do no harm,
-# so we leave it to be run manually -- bstraph stows but does not restow.
-# Possibly restowing could be done by locmaint, or we could have hstow skip
-# annex/ and src/, into which I don't stow anything.
fixups = bstraph
# --- private dotfiles repositories
@@ -141,7 +137,7 @@ checkout = git clone athenag:libpriv.git priv
update = git annex sync --content cloud origin
push = git annex sync --content cloud origin
post_update =
- hstow stow ~/lib/priv
+ hstow restow ~/lib/priv
load-trustdb
sync = mr autoci && git annex sync --no-commit --content cloud origin
skip = lazy
@@ -187,7 +183,7 @@ pre_update = mr autoci
checkout = git clone demeterp:athpriv athpriv
pre_update = on athena || git annex sync origin athenah
pre_push = on athena || git annex sync --content origin athenah
-post_update = hstow stow ~/src/athpriv
+post_update = hstow restow ~/src/athpriv
post_checkout = hstow stow ~/src/athpriv
skip = ! mine