Adds automatic symlink detection

This commit is contained in:
Michel Fedde 2025-02-23 22:30:18 +01:00
parent 2710c15850
commit 9c0d6169ec
4 changed files with 55 additions and 6 deletions

View file

@ -1,3 +1,5 @@
#!/bin/env sh
yay -S --needed yazi p7zip jq poppler fd ripgrep fzf zoxide imagemagick
yay -S --needed yazi p7zip jq poppler fd ripgrep fzf zoxide imagemagick fuse-archive zip
ya pack --install

2
.config/yadm/config Normal file
View file

@ -0,0 +1,2 @@
[yadm]
auto-alt = false

28
.config/yadm/hooks/pre_commit Executable file
View file

@ -0,0 +1,28 @@
#!/bin/env sh
foundSymlinks=false
for file in $(yadm diff --name-only --cached); do
lsResult=$(ls -1 -l "$file")
if [[ $lsResult != *"->"* ]]; then
break
fi
symlinkTarget=$(echo "$lsResult" | awk '{print $NF}')
if [[ $lsResult != *"##"* ]]; then
break
fi
echo "$file is a YADM symlink. Telling git to ignore it..."
yadm restore --staged "$file"
echo "$file" >>~/.gitignore
foundSymlinks=true
done
if [ $foundSymlinks ]; then
echo "Symlinks found. Adding .gitignore to commit..."
yadm add ~/.gitignore
fi