@@ -217,31 +217,40 @@ test_expect_success 'invalid push option in config' '
217
217
test_refs master HEAD@{1}
218
218
'
219
219
220
+ test_expect_success ' push options keep quoted characters intact (direct)' '
221
+ mk_repo_pair &&
222
+ git -C upstream config receive.advertisePushOptions true &&
223
+ test_commit -C workbench one &&
224
+ git -C workbench push --push-option="\"embedded quotes\"" up master &&
225
+ echo "\"embedded quotes\"" >expect &&
226
+ test_cmp expect upstream/.git/hooks/pre-receive.push_options
227
+ '
228
+
220
229
. " $TEST_DIRECTORY " /lib-httpd.sh
221
230
start_httpd
222
231
223
- test_expect_success ' push option denied properly by http server' '
232
+ # set up http repository for fetching/pushing, with push options config
233
+ # bool set to $1
234
+ mk_http_pair () {
224
235
test_when_finished " rm -rf test_http_clone" &&
225
- test_when_finished " rm -rf \ "$HTTPD_DOCUMENT_ROOT_PATH\ "/upstream.git" &&
236
+ test_when_finished ' rm -rf "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git' &&
226
237
mk_repo_pair &&
227
- git -C upstream config receive.advertisePushOptions false &&
238
+ git -C upstream config receive.advertisePushOptions " $1 " &&
228
239
git -C upstream config http.receivepack true &&
229
240
cp -R upstream/.git " $HTTPD_DOCUMENT_ROOT_PATH " /upstream.git &&
230
- git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
241
+ git clone " $HTTPD_URL " /smart/upstream test_http_clone
242
+ }
243
+
244
+ test_expect_success ' push option denied properly by http server' '
245
+ mk_http_pair false &&
231
246
test_commit -C test_http_clone one &&
232
247
test_must_fail git -C test_http_clone push --push-option=asdf origin master 2>actual &&
233
248
test_i18ngrep "the receiving end does not support push options" actual &&
234
249
git -C test_http_clone push origin master
235
250
'
236
251
237
252
test_expect_success ' push options work properly across http' '
238
- test_when_finished "rm -rf test_http_clone" &&
239
- test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" &&
240
- mk_repo_pair &&
241
- git -C upstream config receive.advertisePushOptions true &&
242
- git -C upstream config http.receivepack true &&
243
- cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git &&
244
- git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
253
+ mk_http_pair true &&
245
254
246
255
test_commit -C test_http_clone one &&
247
256
git -C test_http_clone push origin master &&
@@ -260,6 +269,15 @@ test_expect_success 'push options work properly across http' '
260
269
test_cmp expect actual
261
270
'
262
271
272
+ test_expect_success ' push options keep quoted characters intact (http)' '
273
+ mk_http_pair true &&
274
+
275
+ test_commit -C test_http_clone one &&
276
+ git -C test_http_clone push --push-option="\"embedded quotes\"" origin master &&
277
+ echo "\"embedded quotes\"" >expect &&
278
+ test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options
279
+ '
280
+
263
281
stop_httpd
264
282
265
283
test_done
0 commit comments