add --html-path to get the location of installed HTML docs
[git/dscho.git] / t / t5503-tagfollow.sh
blobe75ccbcaebbe8cf2ac0fdf5dfe474a9b9a3043ab
1 #!/bin/sh
3 test_description='test automatic tag following'
5 . ./test-lib.sh
7 case $(uname -s) in
8 *MINGW*)
9 say "GIT_DEBUG_SEND_PACK not supported - skipping tests"
10 test_done
11 exit
12 esac
14 # End state of the repository:
16 # T - tag1 S - tag2
17 # / /
18 # L - A ------ O ------ B
19 # \ \ \
20 # \ C - origin/cat \
21 # origin/master master
23 test_expect_success setup '
24 test_tick &&
25 echo ichi >file &&
26 git add file &&
27 git commit -m L &&
28 L=$(git rev-parse --verify HEAD) &&
31 mkdir cloned &&
32 cd cloned &&
33 git init-db &&
34 git remote add -f origin ..
35 ) &&
37 test_tick &&
38 echo A >file &&
39 git add file &&
40 git commit -m A &&
41 A=$(git rev-parse --verify HEAD)
44 U=UPLOAD_LOG
46 cat - <<EOF >expect
48 want $A
50 EOF
51 test_expect_success 'fetch A (new commit : 1 connection)' '
52 rm -f $U
54 cd cloned &&
55 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
56 test $A = $(git rev-parse --verify origin/master)
57 ) &&
58 test -s $U &&
59 cut -d" " -f1,2 $U >actual &&
60 test_cmp expect actual
63 test_expect_success "create tag T on A, create C on branch cat" '
64 git tag -a -m tag1 tag1 $A &&
65 T=$(git rev-parse --verify tag1) &&
67 git checkout -b cat &&
68 echo C >file &&
69 git add file &&
70 git commit -m C &&
71 C=$(git rev-parse --verify HEAD) &&
72 git checkout master
75 cat - <<EOF >expect
77 want $C
78 want $T
80 EOF
81 test_expect_success 'fetch C, T (new branch, tag : 1 connection)' '
82 rm -f $U
84 cd cloned &&
85 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
86 test $C = $(git rev-parse --verify origin/cat) &&
87 test $T = $(git rev-parse --verify tag1) &&
88 test $A = $(git rev-parse --verify tag1^0)
89 ) &&
90 test -s $U &&
91 cut -d" " -f1,2 $U >actual &&
92 test_cmp expect actual
95 test_expect_success "create commits O, B, tag S on B" '
96 test_tick &&
97 echo O >file &&
98 git add file &&
99 git commit -m O &&
101 test_tick &&
102 echo B >file &&
103 git add file &&
104 git commit -m B &&
105 B=$(git rev-parse --verify HEAD) &&
107 git tag -a -m tag2 tag2 $B &&
108 S=$(git rev-parse --verify tag2)
111 cat - <<EOF >expect
113 want $B
114 want $S
117 test_expect_success 'fetch B, S (commit and tag : 1 connection)' '
118 rm -f $U
120 cd cloned &&
121 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
122 test $B = $(git rev-parse --verify origin/master) &&
123 test $B = $(git rev-parse --verify tag2^0) &&
124 test $S = $(git rev-parse --verify tag2)
125 ) &&
126 test -s $U &&
127 cut -d" " -f1,2 $U >actual &&
128 test_cmp expect actual
131 cat - <<EOF >expect
133 want $B
134 want $S
137 test_expect_success 'new clone fetch master and tags' '
138 git branch -D cat
139 rm -f $U
141 mkdir clone2 &&
142 cd clone2 &&
143 git init &&
144 git remote add origin .. &&
145 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
146 test $B = $(git rev-parse --verify origin/master) &&
147 test $S = $(git rev-parse --verify tag2) &&
148 test $B = $(git rev-parse --verify tag2^0) &&
149 test $T = $(git rev-parse --verify tag1) &&
150 test $A = $(git rev-parse --verify tag1^0)
151 ) &&
152 test -s $U &&
153 cut -d" " -f1,2 $U >actual &&
154 test_cmp expect actual
157 test_done