From 60f4fa4f4eb1eda43e1f59246b94113e85292446 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Wed, 21 Aug 2013 13:01:41 +0200 Subject: feat(git-svn-fix-authors): Fix authors information on git-svn cloned repo. Mapping is taken from $(git config svn.authorsfile) file. --- git-svn-fix-authors.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 git-svn-fix-authors.sh (limited to 'git-svn-fix-authors.sh') 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 -- cgit