t1200: fix a timing dependent error
The fourth test of show-branch in t1200 test was failing but only sometimes. It only failed when two commits created in an earlier test had different timestamps. When they were created within the same second, the actual output matched the expected output. Fix this by using test_tick to force reliable timestamps and update the expected output so it does not to depend on the commits made in the same sacond. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nanako Shiraishi committed
Nov 25, 2009 at 08:08 UTC
5d166ccb89faadb7ce5f36d2e33abbd7bb103117
2 files changed
+9
-5
Documentation/gitcore-tutorial.txt
+2
-2
@@ -1186,9 +1186,9 @@ $ git show-branch
1186
* [master] Some fun.
1187
! [mybranch] Some work.
1188
--
1189
- + [mybranch] Some work.
1189
* [master] Some fun.
1191
-*+ [mybranch^] Initial commit
1190
+ + [mybranch] Some work.
1191
+*+ [master^] Initial commit
1192
------------
1193
1194
Now we are ready to experiment with the merge by hand.
t/t1200-tutorial.sh
+7
-3
@@ -47,7 +47,8 @@ test_expect_success 'tree' '
47
'
48
49
test_expect_success 'git diff-index -p HEAD' '
50
- tree=$(git write-tree)
50
+ test_tick &&
51
+ tree=$(git write-tree) &&
52
commit=$(echo "Initial commit" | git commit-tree $tree) &&
53
git update-ref HEAD $commit &&
54
git diff-index -p HEAD > diff.output &&
@@ -113,12 +114,14 @@ test_expect_success 'git branch' '
114
test_expect_success 'git resolve now fails' '
115
git checkout mybranch &&
116
echo "Work, work, work" >>hello &&
117
+ test_tick &&
118
git commit -m "Some work." -i hello &&
119
120
git checkout master &&
121
122
echo "Play, play, play" >>hello &&
123
echo "Lots of fun" >>example &&
124
+ test_tick &&
125
git commit -m "Some fun." -i hello example &&
126
127
test_must_fail git merge -m "Merge work in mybranch" mybranch
@@ -141,6 +144,7 @@ cat > show-branch.expect << EOF
144
EOF
145
146
test_expect_success 'git show-branch' '
147
+ test_tick &&
148
git commit -m "Merge work in mybranch" -i hello &&
149
git show-branch --topo-order --more=1 master mybranch \
150
> show-branch.output &&
@@ -201,9 +205,9 @@ cat > show-branch4.expect << EOF
205
* [master] Some fun.
206
! [mybranch] Some work.
207
--
204
- + [mybranch] Some work.
208
* [master] Some fun.
206
-*+ [mybranch^] Initial commit
209
+ + [mybranch] Some work.
210
+*+ [master^] Initial commit
211
EOF
212
213
test_expect_success 'git show-branch (part 4)' '