Skip to content

Commit a4fc49a

Browse files
authored
Merge pull request #165 from mhagger/smoother-tests
Make the tests a bit smoother and faster
2 parents bb3d2c9 + abbb0ef commit a4fc49a

2 files changed

Lines changed: 17 additions & 21 deletions

File tree

t/create-test-repo

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ set -e
44

55
DESCRIPTION="git-imerge test repository"
66

7-
# Sleep between commits to give commits distinct timestamps:
8-
SLEEP="sleep 1"
9-
107
modify() {
118
filename="$1"
129
text="$2"
1310
echo "$text" >"$filename" &&
1411
git add "$filename"
1512
}
1613

14+
TIME=1112911993
15+
16+
commit() {
17+
TIME=$(( TIME + 1 ))
18+
GIT_AUTHOR_DATE="@$TIME +0000" GIT_COMMITTER_DATE="@$TIME +0000" git commit "$@"
19+
}
20+
1721
BASE="$(dirname "$(cd $(dirname "$0") && pwd)")"
1822
TMP="$BASE/t/tmp/main"
1923

@@ -38,56 +42,48 @@ git config user.name 'Loú User'
3842
git config user.email 'luser@example.com'
3943

4044
modify a.txt 0
41-
git commit -m 'm⇒0'
42-
$SLEEP
45+
commit -m 'm⇒0'
4346

4447
git checkout -b a --
4548
for i in $(seq 8)
4649
do
4750
modify a.txt $i
48-
git commit -m "a⇒$i"
49-
$SLEEP
51+
commit -m "a⇒$i"
5052
done
5153

5254
git checkout -b b master --
5355
for i in $(seq 5)
5456
do
5557
modify b.txt $i
56-
git commit -m "b⇒$i"
57-
$SLEEP
58+
commit -m "b⇒$i"
5859
done
5960

6061
git checkout -b c master --
6162
for i in $(seq 3)
6263
do
6364
modify c.txt $i
64-
git commit -m "c⇒$i"
65-
$SLEEP
65+
commit -m "c⇒$i"
6666
done
6767
modify conflict.txt "c version"
68-
git commit -m "c conflict"
69-
$SLEEP
68+
commit -m "c conflict"
7069
for i in $(seq 4 8)
7170
do
7271
modify c.txt $i
73-
git commit -m "c⇒$i"
74-
$SLEEP
72+
commit -m "c⇒$i"
7573
done
7674

7775
git checkout -b d master --
7876
for i in $(seq 2)
7977
do
8078
modify d.txt $i
81-
git commit -m "d⇒$i"
82-
$SLEEP
79+
commit -m "d⇒$i"
8380
done
8481
modify conflict.txt "d version"
85-
git commit -m "d conflict"
82+
commit -m "d conflict"
8683
for i in $(seq 3 5)
8784
do
8885
modify d.txt $i
89-
git commit -m "d⇒$i"
90-
$SLEEP
86+
commit -m "d⇒$i"
9187
done
9288

9389
git checkout master --

t/test-drop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ git checkout -b reverted master
4747
"$GIT_IMERGE" diagram --commits --frontier --html=imerge-revert.html
4848
"$GIT_IMERGE" finish
4949

50-
git diff dropped reverted
50+
git --no-pager diff dropped reverted
5151

0 commit comments

Comments
 (0)