forked from dpocock/sync2git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-test-authors
executable file
·61 lines (46 loc) · 1.25 KB
/
git-test-authors
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -e
if [ $# -lt 2 ];
then
echo "$0 <authors file> <dest repo for push>"
exit 1
fi
AUTHORS_FILE="`pwd`/$1"
DEST_REPO="$2"
if [ ! -e "${AUTHORS_FILE}" ];
then
echo "can't find ${AUTHORS_FILE}, aborting"
exit 1
fi
TMP_REPO=`mktemp -d`
TARGET_FILE="testing.txt"
cd "${TMP_REPO}"
git init .
cp "${AUTHORS_FILE}" .
git add `basename "${AUTHORS_FILE}"`
git commit -m 'Import authors.txt file'
cat >> README.txt << EOF
This is a dummy repository containing dummy commits
It has been created with 1 dummy commit from each contributor in authors.txt
so that we can view the commit history in github and work out which
contributors are correctly mapped to github accounts.
EOF
git add README.txt
git commit -m 'Add README'
cat "${AUTHORS_FILE}" | while read ;
do
full_info=`echo "${REPLY}" | cut -f2 -d'=' | cut -b2-`
an="`echo "${full_info}" | sed -e "s/ <.*\$//\"`"
am="`echo "${full_info}" | sed -e "s/^.*</</\"`"
cn="$an"
cm="$am"
echo "$REPLY" >> "${TARGET_FILE}"
git add "${TARGET_FILE}"
export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"
git commit -m "Test adding ${REPLY}"
done
git remote add origin "${DEST_REPO}"
git push -u -f origin master