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
No known key found for this signature in database
GPG key ID: F6E11C9BAA7C82F5

View file

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
# vim: set noexpandtab:
BOLD="$(tput bold)" BOLD="$(tput bold)"
RED="$(tput setaf 1)" RED="$(tput setaf 1)"
@ -37,20 +38,20 @@ first_clone() {
exit 1 exit 1
} }
filter_file=$(mktemp) filter_file=$(mktemp)
cat <<'EOF' >"$filter_file" cat <<-'EOF' >"$filter_file"
#!/bin/sh #!/bin/sh
FS="#" FS="#"
GS="|" 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 }')" 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 }')" sed "$(echo "$map" | awk -F"$FS" -v d="$GS" '{printf "s%s<#%s#>%s%s%sg;", d, $1, d, $2, d }')"
fi fi
EOF EOF
chmod +x "$filter_file" chmod +x "$filter_file"
touch "${HOME}/.gitconfig" touch "${HOME}/.gitconfig"
git config --global filter.redact.clean "$filter_file clean" git config --global filter.redact.clean "$filter_file clean"