aboutsummaryrefslogtreecommitdiffstats
path: root/git-svn-fix-authors.sh
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2013-08-21 13:51:50 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-03-01 01:24:18 +0100
commit53a8fe1e9513d9116cd8ee99129041dfa111d9b9 (patch)
tree4fcce2ed2a08b27794dd63b157d564b5788a30c0 /git-svn-fix-authors.sh
parent9f42485b9a20a4e991198232eb8121d5bfbc4981 (diff)
downloadhlupak-53a8fe1e9513d9116cd8ee99129041dfa111d9b9.tar.gz
fix(git-svn-fix-authors): Allow middle names.
And don't overuse export when it is not needed.
Diffstat (limited to 'git-svn-fix-authors.sh')
-rwxr-xr-xgit-svn-fix-authors.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/git-svn-fix-authors.sh b/git-svn-fix-authors.sh
index f78bfbe..16acdf4 100755
--- a/git-svn-fix-authors.sh
+++ b/git-svn-fix-authors.sh
@@ -3,19 +3,25 @@ set -eu
AUTHORS_FILE=$(git config svn.authorsfile) || {
echo "ERROR: set config.svn.authorsfile!"
- exit 1
+ exit 128
}
export AUTHORS_FILE=$(readlink -f $AUTHORS_FILE)
git filter-branch --env-filter '
function replacement() {
- REPL=$(awk -F"[[:space:]]*=[[:space:]]*" "/$1/ {print \$2;}" $AUTHORS_FILE)
- MAIL=$(echo $REPL|awk "{print \$NF}"|tr -d "<>" )
- NAME=$(echo $REPL|awk "{print \$1, \$2}" )
+ REPL=$(awk -F"[[:space:]]*=[[:space:]]*" "/$1/ {print \$2}" $AUTHORS_FILE)
+ MAIL=$(echo "$REPL"|awk "{print \$NF}"|tr -d "<>" )
+ NAME=$(echo "$REPL"|awk "{print gensub(/[[:space:]]*<[^[:space:]]*/,\"\",\"\")}" )
}
replacement "${GIT_AUTHOR_NAME}"
+if [ "x$NAME" == "x" ] ; then
+ echo -e "\nERROR: When changing ${GIT_COMMIT} we got empty reply."
+ echo -e "I do not know how to map ${GIT_AUTHOR_NAME}.\n"
+ set|grep ^GIT
+ exit 1
+fi
export GIT_AUTHOR_NAME="$NAME"
export GIT_AUTHOR_EMAIL="$MAIL"