summaryrefslogtreecommitdiff
path: root/rename_authors.sh
blob: f8d4815fb06340a40f9c925a9cd5f85fab0aad41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

# Update the committer and author according to the git_authors file.

DEVS_PATH='$(pwd)/git_authors'

while read dir
do
   dev="$(echo $dir | cut -d':' -f1)"
   if [ "x$dev" == "x$GIT_COMMITTER_NAME" ]; then
      nc="$(echo $dir | cut -d':' -f2)"
      mc="$(echo $dir | cut -d':' -f3)"
      if [ "x$dev" == "x$GIT_AUTHOR_NAME" ]; then
        na="$(echo $dir | cut -d':' -f2)"
        ma="$(echo $dir | cut -d':' -f3)"
      fi
      break
   fi
done < $DEVS_PATH

[ "x$na" == "x" ] && na=$GIT_AUTHOR_NAME
[ "x$ma" == "x" ] && ma=$GIT_AUTHOR_EMAIL
[ "x$nc" == "x" ] && nc=$GIT_COMMITTER_NAME
[ "x$mc" == "x" ] && mc=$GIT_COMMITTER_EMAIL
echo "export GIT_AUTHOR_NAME=\"$na\""
echo "export GIT_AUTHOR_EMAIL=\"$ma\""
echo "export GIT_COMMITTER_NAME=\"$nc\""
echo "export GIT_COMMITTER_EMAIL=\"$mc\""