From 47e61d036abb2f831af9f2bac33273afc84329d5 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 19 Aug 2017 14:55:02 -0400 Subject: [PATCH] git-rewrite-authors: handle more edge cases --- .bin/git-rewrite-authors | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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)"; \ ' "$@" -- 2.39.5