1
0
Fork 0

dotsync: use tabs rather than spaces

This commit is contained in:
Luca Bilke 2024-10-17 11:17:22 +02:00
commit b4ad04e6be
Signed by: luca
GPG key ID: F6E11C9BAA7C82F5

View file

@ -1,4 +1,5 @@
#!/bin/sh
# vim: set noexpandtab:
BOLD="$(tput bold)"
RED="$(tput setaf 1)"
@ -37,20 +38,20 @@ first_clone() {
exit 1
}
filter_file=$(mktemp)
cat <<'EOF' >"$filter_file"
#!/bin/sh
cat <<-'EOF' >"$filter_file"
#!/bin/sh
FS="#"
GS="|"
FS="#"
GS="|"
map=$(jq -r 'to_entries[] | "\(.key)'"$FS"'\(.value)"' "${HOME}/.secrets/dotfile-secrets.json")
map=$(jq -r 'to_entries[] | "\(.key)'"$FS"'\(.value)"' "${HOME}/.secrets/dotfile-secrets.json")
if [ "$1" = "clean" ]; then
if [ "$1" = "clean" ]; then
sed "$(echo "$map" | awk -F"$FS" -v d="$GS" '{printf "s%s%s%s<#%s#>%sg;", d, $2, d, $1, d }')"
elif [ "$1" = "smudge" ]; then
elif [ "$1" = "smudge" ]; then
sed "$(echo "$map" | awk -F"$FS" -v d="$GS" '{printf "s%s<#%s#>%s%s%sg;", d, $1, d, $2, d }')"
fi
EOF
fi
EOF
chmod +x "$filter_file"
touch "${HOME}/.gitconfig"
git config --global filter.redact.clean "$filter_file clean"