@@ -102,17 +102,46 @@ test_expect_success 'two push options work' '
102102 test_cmp expect upstream/.git/hooks/post-receive.push_options
103103'
104104
105- test_expect_success ' push option denied properly by http remote helper' ' \
105+ test_expect_success ' push option denied properly by http server' '
106+ test_when_finished "rm -rf test_http_clone" &&
107+ test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" &&
106108 mk_repo_pair &&
107109 git -C upstream config receive.advertisePushOptions false &&
108110 git -C upstream config http.receivepack true &&
109111 cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git &&
110112 git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
111113 test_commit -C test_http_clone one &&
112- test_must_fail git -C test_http_clone push --push-option=asdf origin master &&
114+ test_must_fail git -C test_http_clone push --push-option=asdf origin master 2>actual &&
115+ test_i18ngrep "the receiving end does not support push options" actual &&
113116 git -C test_http_clone push origin master
114117'
115118
119+ test_expect_success ' push options work properly across http' '
120+ test_when_finished "rm -rf test_http_clone" &&
121+ test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" &&
122+ mk_repo_pair &&
123+ git -C upstream config receive.advertisePushOptions true &&
124+ git -C upstream config http.receivepack true &&
125+ cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git &&
126+ git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
127+
128+ test_commit -C test_http_clone one &&
129+ git -C test_http_clone push origin master &&
130+ git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
131+ git -C test_http_clone rev-parse --verify master >actual &&
132+ test_cmp expect actual &&
133+
134+ test_commit -C test_http_clone two &&
135+ git -C test_http_clone push --push-option=asdf --push-option="more structured text" origin master &&
136+ printf "asdf\nmore structured text\n" >expect &&
137+ test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options &&
138+ test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/post-receive.push_options &&
139+
140+ git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
141+ git -C test_http_clone rev-parse --verify master >actual &&
142+ test_cmp expect actual
143+ '
144+
116145stop_httpd
117146
118147test_done
0 commit comments