aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/install.sh
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2023-10-12 17:40:21 -0500
committerToby Vincent <tobyv@tobyvin.dev>2023-10-12 17:40:21 -0500
commit1efbb841134aec2fb1a207cbae6cda3b638c9274 (patch)
tree189d77b6868f84209ff221c545c4a3a2bef3e4f6 /install.sh
parent38b8fd29a6ce554f666db5a47517d1a5308136ca (diff)
perf: use git tree to search for broken links
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/install.sh b/install.sh
index b4e0c4e..1bd59c6 100755
--- a/install.sh
+++ b/install.sh
@@ -1,10 +1,18 @@
#!/bin/sh
# shellcheck disable=SC2035,SC2016
+set -e
+
CDPATH='' cd -- "$(dirname -- "$0")" || exit
printf "%s: Removing bad links\n" "$0"
-fd . .. -Htl -E ./**/ -x sh -c '[ -e "{}" ] || (readlink -m "{}" | grep '"$PWD"' -q && rm -v "{}")'
+git diff-tree --no-commit-id --name-status e6051a3..HEAD -r |
+ grep -oP 'D\t[^/]+/\K(.*)' |
+ while read -r f; do
+ if [ -L "../$f" ] && [ ! -e "../$f" ]; then
+ rm -v "../$f"
+ fi
+ done
printf "%s: Stowing packages\n" "$0"
stow "$@" */