This rejection requires us to make sure we handle this kind of error correctly rather than throw away the report in remote-curl and end up with "Everything up-to-date" due to the lack of report. Signed-off-by: Carlos Martín Nieto <cmn@xxxxxxx> --- t/t5546-receive-limits.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/t/t5546-receive-limits.sh b/t/t5546-receive-limits.sh index 9fc9ba552f1..ccbdf3945ab 100755 --- a/t/t5546-receive-limits.sh +++ b/t/t5546-receive-limits.sh @@ -5,6 +5,11 @@ test_description='check receive input limits' TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh + +ROOT_PATH="$PWD" +. "$TEST_DIRECTORY"/lib-httpd.sh +start_serve_git + # Let's run tests with different unpack limits: 1 and 10000 # When the limit is 1, `git receive-pack` will call `git index-pack`. # When the limit is 10000, `git receive-pack` will call `git unpack-objects`. @@ -83,4 +88,23 @@ test_expect_success "create known-size (1024 bytes) commit" ' test_pack_input_limit index test_pack_input_limit unpack +test_expect_success 'reject too-large push over HTTP' ' + git init "$HTTPD_DOCUMENT_ROOT_PATH/error_too_large" && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/error_too_large" config receive.maxInputSize 128 && + test-tool genrandom foo $((10*1024*1024)) >large-file && + git add large-file && + test_commit large-file && + test_must_fail git push --porcelain \ + $GIT_SERVE_URL/error_too_large \ + HEAD:refs/tags/will-fail >actual && + test_must_fail git -C "$HTTPD_DOCUMENT_ROOT_PATH/error_too_large" \ + rev-parse --verify refs/tags/will-fail && + cat >expect <<-EOF && + To $GIT_SERVE_URL/error_too_large + ! HEAD:refs/tags/will-fail [remote rejected] (unpacker error) + Done + EOF + test_cmp expect actual +' + test_done -- 2.43.0