forked from FaustXVI/tcrdd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_utils.sh
52 lines (42 loc) · 1.06 KB
/
test_utils.sh
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
#!/usr/bin/env bash
runInto() {
currentDirectory=`pwd`
cd $1
shift
"$@"
cd $currentDirectory
}
runAsAlice() {
runInto ${aliceClone} "$@"
}
runAsBob() {
runInto ${bobClone} "$@"
}
createRepositories() {
git init --bare ${bareRepository}
git clone ${bareRepository} ${aliceClone}
runAsAlice git config user.name Alice
runAsAlice git config user.email [email protected]
runAsAlice git commit --allow-empty -m "Initial commit" > /dev/null
cp ./tcrdd.sh ${aliceClone}/tcrdd.sh
runAsAlice git add tcrdd.sh
runAsAlice git commit -m "Add tcrdd script" > /dev/null
runAsAlice git push > /dev/null 2>&1
git clone ${bareRepository} ${bobClone}
runAsBob git config user.name Bob
runAsBob git config user.email [email protected]
}
deleteRepositories() {
rm -rf ${bareRepository} ${aliceClone} ${bobClone}
}
getHeadHash() {
git log HEAD -1 --pretty=%H
}
getHeadMessage() {
git log HEAD -1 --pretty=%B
}
getOriginHeadHash() {
git log origin/master -1 --pretty=%H
}
and_tests_pass=true
and_tests_fail=false