~ubuntu-branches/debian/sid/git/sid

« back to all changes in this revision

Viewing changes to t/t5551-http-fetch.sh

  • Committer: Package Import Robot
  • Author(s): Jonathan Nieder
  • Date: 2013-06-12 07:50:53 UTC
  • mfrom: (1.2.19) (2.1.31 experimental)
  • Revision ID: package-import@ubuntu.com-20130612075053-uue9xe0dq0rvm44y
Tags: 1:1.8.3.1-1
* merge branch debian-experimental
* new upstream point release (see RelNotes/1.8.3.1.txt).
* debian/watch: use xz-compressed tarballs from kernel.org.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
start_httpd
14
14
 
15
15
test_expect_success 'setup repository' '
 
16
        git config push.default matching &&
16
17
        echo content >file &&
17
18
        git add file &&
18
19
        git commit -m one
27
28
        git push public master:master
28
29
'
29
30
 
 
31
setup_askpass_helper
 
32
 
30
33
cat >exp <<EOF
31
34
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
32
35
> Accept: */*
 
36
> Accept-Encoding: gzip
33
37
> Pragma: no-cache
34
38
< HTTP/1.1 200 OK
35
39
< Pragma: no-cache
36
40
< Cache-Control: no-cache, max-age=0, must-revalidate
37
41
< Content-Type: application/x-git-upload-pack-advertisement
38
42
> POST /smart/repo.git/git-upload-pack HTTP/1.1
39
 
> Accept-Encoding: deflate, gzip
 
43
> Accept-Encoding: gzip
40
44
> Content-Type: application/x-git-upload-pack-request
41
45
> Accept: application/x-git-upload-pack-result
42
46
> Content-Length: xxx
109
113
        git clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t
110
114
'
111
115
 
 
116
test_expect_success 'clone from password-protected repository' '
 
117
        echo two >expect &&
 
118
        set_askpass user@host &&
 
119
        git clone --bare "$HTTPD_URL/auth/smart/repo.git" smart-auth &&
 
120
        expect_askpass both user@host &&
 
121
        git --git-dir=smart-auth log -1 --format=%s >actual &&
 
122
        test_cmp expect actual
 
123
'
 
124
 
 
125
test_expect_success 'clone from auth-only-for-push repository' '
 
126
        echo two >expect &&
 
127
        set_askpass wrong &&
 
128
        git clone --bare "$HTTPD_URL/auth-push/smart/repo.git" smart-noauth &&
 
129
        expect_askpass none &&
 
130
        git --git-dir=smart-noauth log -1 --format=%s >actual &&
 
131
        test_cmp expect actual
 
132
'
 
133
 
 
134
test_expect_success 'clone from auth-only-for-objects repository' '
 
135
        echo two >expect &&
 
136
        set_askpass user@host &&
 
137
        git clone --bare "$HTTPD_URL/auth-fetch/smart/repo.git" half-auth &&
 
138
        expect_askpass both user@host &&
 
139
        git --git-dir=half-auth log -1 --format=%s >actual &&
 
140
        test_cmp expect actual
 
141
'
 
142
 
 
143
test_expect_success 'no-op half-auth fetch does not require a password' '
 
144
        set_askpass wrong &&
 
145
        git --git-dir=half-auth fetch &&
 
146
        expect_askpass none
 
147
'
 
148
 
 
149
test_expect_success 'disable dumb http on server' '
 
150
        git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
 
151
                config http.getanyfile false
 
152
'
 
153
 
 
154
test_expect_success 'GIT_SMART_HTTP can disable smart http' '
 
155
        (GIT_SMART_HTTP=0 &&
 
156
         export GIT_SMART_HTTP &&
 
157
         cd clone &&
 
158
         test_must_fail git fetch)
 
159
'
 
160
 
 
161
test_expect_success 'invalid Content-Type rejected' '
 
162
        test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual
 
163
        grep "not valid:" actual
 
164
'
 
165
 
 
166
test_expect_success 'create namespaced refs' '
 
167
        test_commit namespaced &&
 
168
        git push public HEAD:refs/namespaces/ns/refs/heads/master &&
 
169
        git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
 
170
                symbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/master
 
171
'
 
172
 
 
173
test_expect_success 'smart clone respects namespace' '
 
174
        git clone "$HTTPD_URL/smart_namespace/repo.git" ns-smart &&
 
175
        echo namespaced >expect &&
 
176
        git --git-dir=ns-smart/.git log -1 --format=%s >actual &&
 
177
        test_cmp expect actual
 
178
'
 
179
 
 
180
test_expect_success 'dumb clone via http-backend respects namespace' '
 
181
        git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
 
182
                config http.getanyfile true &&
 
183
        GIT_SMART_HTTP=0 git clone \
 
184
                "$HTTPD_URL/smart_namespace/repo.git" ns-dumb &&
 
185
        echo namespaced >expect &&
 
186
        git --git-dir=ns-dumb/.git log -1 --format=%s >actual &&
 
187
        test_cmp expect actual
 
188
'
 
189
 
112
190
test -n "$GIT_TEST_LONG" && test_set_prereq EXPENSIVE
113
191
 
114
192
test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
115
193
        (
116
194
        cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
117
 
        for i in `seq 50000`
 
195
        for i in `test_seq 50000`
118
196
        do
119
197
                echo "commit refs/heads/too-many-refs"
120
198
                echo "mark :$i"
130
208
        done | git fast-import --export-marks=marks &&
131
209
 
132
210
        # now assign tags to all the dangling commits we created above
133
 
        tag=$(perl -e "print \"bla\" x 30") &&
 
211
        tag=$("$PERL_PATH" -e "print \"bla\" x 30") &&
134
212
        sed -e "s/^:\(.\+\) \(.\+\)$/\2 refs\/tags\/$tag-\1/" <marks >>packed-refs
135
213
        )
136
214
'