diff options
author | Matěj Cepl <mcepl@redhat.com> | 2013-08-21 13:01:41 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-03-01 01:24:17 +0100 |
commit | 60f4fa4f4eb1eda43e1f59246b94113e85292446 (patch) | |
tree | 5f2abc265679ae97a9ca158de6cfb0987624bdde /git-svn-fix-authors.sh | |
parent | 2769e5827d62a2d17c2fa7a0e14e461b6fddfda1 (diff) | |
download | hlupak-60f4fa4f4eb1eda43e1f59246b94113e85292446.tar.gz |
feat(git-svn-fix-authors): Fix authors information on git-svn cloned repo.
Mapping is taken from $(git config svn.authorsfile) file.
Diffstat (limited to 'git-svn-fix-authors.sh')
-rwxr-xr-x | git-svn-fix-authors.sh | 24 |
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 |