aboutsummaryrefslogtreecommitdiffstats
path: root/git-svn-fix-authors.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-svn-fix-authors.sh')
-rwxr-xr-xgit-svn-fix-authors.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/git-svn-fix-authors.sh b/git-svn-fix-authors.sh
new file mode 100755
index 0000000..f78bfbe
--- /dev/null
+++ b/git-svn-fix-authors.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+set -eu
+
+AUTHORS_FILE=$(git config svn.authorsfile) || {
+ echo "ERROR: set config.svn.authorsfile!"
+ exit 1
+}
+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}" )
+}
+
+replacement "${GIT_AUTHOR_NAME}"
+
+export GIT_AUTHOR_NAME="$NAME"
+export GIT_AUTHOR_EMAIL="$MAIL"
+export GIT_COMMITTER_NAME="$NAME"
+export GIT_COMMITTER_EMAIL="$MAIL"
+' -- --all