aboutsummaryrefslogtreecommitdiffstats
path: root/git-svn-fix-authors.sh
blob: f78bfbef165f509c2616655e55d070b17779111f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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