From: Mike Frysinger Date: Sat, 19 Aug 2017 18:55:02 +0000 (-0400) Subject: git-rewrite-authors: handle more edge cases X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=47e61d036abb2f831af9f2bac33273afc84329d5;p=home.git git-rewrite-authors: handle more edge cases --- diff --git a/.bin/git-rewrite-authors b/.bin/git-rewrite-authors index 4e4c2bf..6017008 100755 --- a/.bin/git-rewrite-authors +++ b/.bin/git-rewrite-authors @@ -7,6 +7,9 @@ decode() { awk -vid="$1" -vtype="$2" '$1 == id { match($0, /^[^=]*=\s*([^<]*)<([^>]*)>/, a); name = gensub(/\s+$/, "", "g", a[1]); + name = gensub(/^"/, "", "g", name); + name = gensub(/"$/, "", "g", name); + name = gensub(/'\''/, "'\''\\\\'\'''\''", "g", name); email = a[2]; print "export GIT_"type"_NAME='\''" name "'\'';" print "export GIT_"type"_EMAIL='\''" email "'\'';" @@ -27,7 +30,7 @@ if [ ! -e "${author_file}" ] ; then exit 1 fi git filter-branch \ - --env-filter ". ${tmp};"' \ - eval `decode "${GIT_AUTHOR_NAME}" AUTHOR`; \ - eval `decode "${GIT_COMMITTER_NAME}" COMMITTER`; \ + --env-filter ". '${tmp}';"' \ + eval "$(decode "${GIT_AUTHOR_NAME}" AUTHOR)"; \ + eval "$(decode "${GIT_COMMITTER_NAME}" COMMITTER)"; \ ' "$@"