From ff01db14f47827b14b23a74404b0f9fe41d2a5f1 Mon Sep 17 00:00:00 2001 From: Felix Nehrke Date: Tue, 9 Sep 2025 00:57:17 +0200 Subject: [PATCH] Improve git hook to remove invalid links In case a file is moved to another location this change will most likely end in a dangling link in the home-dir. This change fixes this by removing links automatically which are off because the target-file has been moved to another location. --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 640baec..c2f2ced 100644 --- a/README.adoc +++ b/README.adoc @@ -46,7 +46,7 @@ That will remove the links pre-commit. cat < .git/hooks/pre-commit #!/usr/bin/env bash set -e -git status --short | grep -E '^D' | sed s/...// | while read f +git status --short | grep -E '^D|^R' | sed 's/...//;s/ -> .*//' | while read f do test -L "\$HOME/\$f" && rm "\$HOME/\$f" done