Let t0000 pass on Windows again
[git/dscho.git] / t / t5503-tagfollow.sh
blobe19a402db72a2fba8956162b849f326cee107c85
1 #!/bin/sh
3 test_description='test automatic tag following'
5 . ./test-lib.sh
7 # End state of the repository:
9 # T - tag1 S - tag2
10 # / /
11 # L - A ------ O ------ B
12 # \ \ \
13 # \ C - origin/cat \
14 # origin/master master
16 test_expect_success setup '
17 test_tick &&
18 echo ichi >file &&
19 git add file &&
20 git commit -m L &&
21 L=$(git rev-parse --verify HEAD) &&
24 mkdir cloned &&
25 cd cloned &&
26 git init-db &&
27 git remote add -f origin ..
28 ) &&
30 test_tick &&
31 echo A >file &&
32 git add file &&
33 git commit -m A &&
34 A=$(git rev-parse --verify HEAD)
37 U=UPLOAD_LOG
39 cat - <<EOF >expect
41 want $A
43 EOF
45 case $(uname -s) in
46 *MINGW*) test_expect=test_expect_failure;;
47 *) test_expect=test_expect_success;;
48 esac
49 $test_expect 'fetch A (new commit : 1 connection)' '
50 rm -f $U
52 cd cloned &&
53 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
54 test $A = $(git rev-parse --verify origin/master)
55 ) &&
56 test -s $U &&
57 cut -d" " -f1,2 $U >actual &&
58 test_cmp expect actual
61 test_expect_success "create tag T on A, create C on branch cat" '
62 git tag -a -m tag1 tag1 $A &&
63 T=$(git rev-parse --verify tag1) &&
65 git checkout -b cat &&
66 echo C >file &&
67 git add file &&
68 git commit -m C &&
69 C=$(git rev-parse --verify HEAD) &&
70 git checkout master
73 cat - <<EOF >expect
75 want $C
76 want $T
78 EOF
79 case $(uname -s) in
80 *MINGW*) test_expect=test_expect_failure;;
81 *) test_expect=test_expect_success;;
82 esac
83 $test_expect 'fetch C, T (new branch, tag : 1 connection)' '
84 rm -f $U
86 cd cloned &&
87 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
88 test $C = $(git rev-parse --verify origin/cat) &&
89 test $T = $(git rev-parse --verify tag1) &&
90 test $A = $(git rev-parse --verify tag1^0)
91 ) &&
92 test -s $U &&
93 cut -d" " -f1,2 $U >actual &&
94 test_cmp expect actual
97 test_expect_success "create commits O, B, tag S on B" '
98 test_tick &&
99 echo O >file &&
100 git add file &&
101 git commit -m O &&
103 test_tick &&
104 echo B >file &&
105 git add file &&
106 git commit -m B &&
107 B=$(git rev-parse --verify HEAD) &&
109 git tag -a -m tag2 tag2 $B &&
110 S=$(git rev-parse --verify tag2)
113 cat - <<EOF >expect
115 want $B
116 want $S
119 case $(uname -s) in
120 *MINGW*) test_expect=test_expect_failure;;
121 *) test_expect=test_expect_success;;
122 esac
123 $test_expect 'fetch B, S (commit and tag : 1 connection)' '
124 rm -f $U
126 cd cloned &&
127 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
128 test $B = $(git rev-parse --verify origin/master) &&
129 test $B = $(git rev-parse --verify tag2^0) &&
130 test $S = $(git rev-parse --verify tag2)
131 ) &&
132 test -s $U &&
133 cut -d" " -f1,2 $U >actual &&
134 test_cmp expect actual
137 cat - <<EOF >expect
139 want $B
140 want $S
143 case $(uname -s) in
144 *MINGW*) test_expect=test_expect_failure;;
145 *) test_expect=test_expect_success;;
146 esac
147 $test_expect 'new clone fetch master and tags' '
148 git branch -D cat
149 rm -f $U
151 mkdir clone2 &&
152 cd clone2 &&
153 git init &&
154 git remote add origin .. &&
155 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
156 test $B = $(git rev-parse --verify origin/master) &&
157 test $S = $(git rev-parse --verify tag2) &&
158 test $B = $(git rev-parse --verify tag2^0) &&
159 test $T = $(git rev-parse --verify tag1) &&
160 test $A = $(git rev-parse --verify tag1^0)
161 ) &&
162 test -s $U &&
163 cut -d" " -f1,2 $U >actual &&
164 test_cmp expect actual
167 test_done