diff --git a/common/.local/libexec/redact_git_filter b/common/.local/libexec/redact_git_filter index f4e22760..45ad85f6 100755 --- a/common/.local/libexec/redact_git_filter +++ b/common/.local/libexec/redact_git_filter @@ -6,9 +6,10 @@ GS="$(printf '\034')" map=$(jq -r 'to_entries[] | "\(.key)'"$FS"'\(.value)"' "${HOME}/.secrets/dotfile-secrets.json") +awk='{gsub(/[^\^]/, "[&]", $2); gsub(/\^/, "\\^", $2);' case $1 in - clean) awk='{printf "s%s%s%s<#%s#>%sg;", d, $2, d, $1, d }' ;; - smudge) awk='{printf "s%s<#%s#>%s%s%sg;", d, $1, d, $2, d }' ;; + clean) awk="${awk}"' printf "s%s%s%s<#%s#>%sg;", d, $2, d, $1, d}' ;; + smudge) awk="${awk}"' printf "s%s<#%s#>%s%s%sg;", d, $1, d, $2, d}' ;; esac sed "$(echo "$map" | awk -F"$FS" -v d="$GS" "$awk")"