|
3 | 3 | test_description='pushing to a repository using push options'
|
4 | 4 |
|
5 | 5 | . ./test-lib.sh
|
6 |
| -. "$TEST_DIRECTORY"/lib-httpd.sh |
7 |
| -start_httpd |
8 | 6 |
|
9 | 7 | mk_repo_pair () {
|
10 | 8 | rm -rf workbench upstream &&
|
@@ -102,46 +100,6 @@ test_expect_success 'two push options work' '
|
102 | 100 | test_cmp expect upstream/.git/hooks/post-receive.push_options
|
103 | 101 | '
|
104 | 102 |
|
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" && |
108 |
| - mk_repo_pair && |
109 |
| - git -C upstream config receive.advertisePushOptions false && |
110 |
| - git -C upstream config http.receivepack true && |
111 |
| - cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git && |
112 |
| - git clone "$HTTPD_URL"/smart/upstream test_http_clone && |
113 |
| - test_commit -C test_http_clone one && |
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 && |
116 |
| - git -C test_http_clone push origin master |
117 |
| -' |
118 |
| - |
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 |
| - |
145 | 103 | test_expect_success 'push options and submodules' '
|
146 | 104 | test_when_finished "rm -rf parent" &&
|
147 | 105 | test_when_finished "rm -rf parent_upstream" &&
|
@@ -182,6 +140,49 @@ test_expect_success 'push options and submodules' '
|
182 | 140 | test_cmp expect parent_upstream/.git/hooks/post-receive.push_options
|
183 | 141 | '
|
184 | 142 |
|
| 143 | +. "$TEST_DIRECTORY"/lib-httpd.sh |
| 144 | +start_httpd |
| 145 | + |
| 146 | +test_expect_success 'push option denied properly by http server' ' |
| 147 | + test_when_finished "rm -rf test_http_clone" && |
| 148 | + test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" && |
| 149 | + mk_repo_pair && |
| 150 | + git -C upstream config receive.advertisePushOptions false && |
| 151 | + git -C upstream config http.receivepack true && |
| 152 | + cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git && |
| 153 | + git clone "$HTTPD_URL"/smart/upstream test_http_clone && |
| 154 | + test_commit -C test_http_clone one && |
| 155 | + test_must_fail git -C test_http_clone push --push-option=asdf origin master 2>actual && |
| 156 | + test_i18ngrep "the receiving end does not support push options" actual && |
| 157 | + git -C test_http_clone push origin master |
| 158 | +' |
| 159 | + |
| 160 | +test_expect_success 'push options work properly across http' ' |
| 161 | + test_when_finished "rm -rf test_http_clone" && |
| 162 | + test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" && |
| 163 | + mk_repo_pair && |
| 164 | + git -C upstream config receive.advertisePushOptions true && |
| 165 | + git -C upstream config http.receivepack true && |
| 166 | + cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git && |
| 167 | + git clone "$HTTPD_URL"/smart/upstream test_http_clone && |
| 168 | +
|
| 169 | + test_commit -C test_http_clone one && |
| 170 | + git -C test_http_clone push origin master && |
| 171 | + git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect && |
| 172 | + git -C test_http_clone rev-parse --verify master >actual && |
| 173 | + test_cmp expect actual && |
| 174 | +
|
| 175 | + test_commit -C test_http_clone two && |
| 176 | + git -C test_http_clone push --push-option=asdf --push-option="more structured text" origin master && |
| 177 | + printf "asdf\nmore structured text\n" >expect && |
| 178 | + test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options && |
| 179 | + test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/post-receive.push_options && |
| 180 | +
|
| 181 | + git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect && |
| 182 | + git -C test_http_clone rev-parse --verify master >actual && |
| 183 | + test_cmp expect actual |
| 184 | +' |
| 185 | + |
185 | 186 | stop_httpd
|
186 | 187 |
|
187 | 188 | test_done
|
0 commit comments