t5400 send-pack test: try a bit more nontrivial transfer.
Not that this reveals anything new, but I did test_tick shell function in test-lib and found it rather cute and nice. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 29, 2006 at 02:25 UTC
04509738b5779c33e59b93e4959b0ac19acab838
2 files changed
+45
-9
t/t5400-send-pack.sh
+34
-9
@@ -8,38 +8,63 @@ test_description='See why rewinding head breaks send-pack
8
'
9
. ./test-lib.sh
10
11
-touch cpio-test
12
-test_expect_success 'working cpio' 'echo cpio-test | cpio -o > /dev/null'
13
-
14
-cnt='1'
11
+cnt=64
12
test_expect_success setup '
13
+ test_tick &&
14
+ mkdir mozart mozart/is &&
15
+ echo "Commit #0" >mozart/is/pink &&
16
+ git-update-index --add mozart/is/pink &&
17
tree=$(git-write-tree) &&
18
commit=$(echo "Commit #0" | git-commit-tree $tree) &&
19
zero=$commit &&
20
parent=$zero &&
20
- for i in $cnt
21
+ i=0 &&
22
+ while test $i -le $cnt
23
do
22
- sleep 1 &&
24
+ i=$(($i+1)) &&
25
+ test_tick &&
26
+ echo "Commit #$i" >mozart/is/pink &&
27
+ git-update-index --add mozart/is/pink &&
28
+ tree=$(git-write-tree) &&
29
commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) &&
30
+ git-update-ref refs/tags/commit$i $commit &&
31
parent=$commit || return 1
32
done &&
33
git-update-ref HEAD "$commit" &&
27
- git-clone -l ./. victim &&
34
+ git-clone ./. victim &&
35
cd victim &&
36
git-log &&
37
cd .. &&
38
git-update-ref HEAD "$zero" &&
39
parent=$zero &&
33
- for i in $cnt
40
+ i=0 &&
41
+ while test $i -le $cnt
42
do
35
- sleep 1 &&
43
+ i=$(($i+1)) &&
44
+ test_tick &&
45
+ echo "Rebase #$i" >mozart/is/pink &&
46
+ git-update-index --add mozart/is/pink &&
47
+ tree=$(git-write-tree) &&
48
commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) &&
49
+ git-update-ref refs/tags/rebase$i $commit &&
50
parent=$commit || return 1
51
done &&
52
git-update-ref HEAD "$commit" &&
53
echo Rebase &&
54
git-log'
55
56
+test_expect_success 'pack the source repository' '
57
+ git repack -a -d &&
58
+ git prune
59
+'
60
+
61
+test_expect_success 'pack the destination repository' '
62
+ cd victim &&
63
+ git repack -a -d &&
64
+ git prune &&
65
+ cd ..
66
+'
67
+
68
test_expect_success \
69
'pushing rewound head should not barf but require --force' '
70
# should not fail but refuse to update.
t/test-lib.sh
+11
@@ -96,6 +96,17 @@ test_count=0
96
97
trap 'echo >&5 "FATAL: Unexpected exit with code $?"; exit 1' exit
98
99
+test_tick () {
100
+ if test -z "${test_tick+set}"
101
+ then
102
+ test_tick=432630000
103
+ else
104
+ test_tick=$(($test_tick + 60))
105
+ fi
106
+ GIT_COMMITTER_DATE=$test_tick
107
+ GIT_AUTHOR_DATE=$test_tick
108
+ export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
109
+}
110
111
# You are not expected to call test_ok_ and test_failure_ directly, use
112
# the text_expect_* functions instead.