Merge branch 'jt/transfer-fsck-across-packs-fix'
The code to fsck objects received across multiple packs during a single git fetch session has been broken when the packfile URI feature was in use. A workaround has been added by disabling the codepath to avoid keeping a packfile that is too small. * jt/transfer-fsck-across-packs-fix: fetch-pack: do not mix --pack_header and packfile urimaint
						commit
						6c46f864e5
					
				|  | @ -846,7 +846,7 @@ static int get_pack(struct fetch_pack_args *args, | ||||||
| 	else | 	else | ||||||
| 		demux.out = xd[0]; | 		demux.out = xd[0]; | ||||||
|  |  | ||||||
| 	if (!args->keep_pack && unpack_limit) { | 	if (!args->keep_pack && unpack_limit && !index_pack_args) { | ||||||
|  |  | ||||||
| 		if (read_pack_header(demux.out, &header)) | 		if (read_pack_header(demux.out, &header)) | ||||||
| 			die(_("protocol error: bad pack header")); | 			die(_("protocol error: bad pack header")); | ||||||
|  | @ -879,7 +879,7 @@ static int get_pack(struct fetch_pack_args *args, | ||||||
| 			strvec_push(&cmd.args, "-v"); | 			strvec_push(&cmd.args, "-v"); | ||||||
| 		if (args->use_thin_pack) | 		if (args->use_thin_pack) | ||||||
| 			strvec_push(&cmd.args, "--fix-thin"); | 			strvec_push(&cmd.args, "--fix-thin"); | ||||||
| 		if (do_keep && (args->lock_pack || unpack_limit)) { | 		if ((do_keep || index_pack_args) && (args->lock_pack || unpack_limit)) { | ||||||
| 			char hostname[HOST_NAME_MAX + 1]; | 			char hostname[HOST_NAME_MAX + 1]; | ||||||
| 			if (xgethostname(hostname, sizeof(hostname))) | 			if (xgethostname(hostname, sizeof(hostname))) | ||||||
| 				xsnprintf(hostname, sizeof(hostname), "localhost"); | 				xsnprintf(hostname, sizeof(hostname), "localhost"); | ||||||
|  |  | ||||||
|  | @ -881,6 +881,27 @@ test_expect_success 'part of packfile response provided as URI' ' | ||||||
| 	test_line_count = 6 filelist | 	test_line_count = 6 filelist | ||||||
| ' | ' | ||||||
|  |  | ||||||
|  | test_expect_success 'packfile URIs with fetch instead of clone' ' | ||||||
|  | 	P="$HTTPD_DOCUMENT_ROOT_PATH/http_parent" && | ||||||
|  | 	rm -rf "$P" http_child log && | ||||||
|  |  | ||||||
|  | 	git init "$P" && | ||||||
|  | 	git -C "$P" config "uploadpack.allowsidebandall" "true" && | ||||||
|  |  | ||||||
|  | 	echo my-blob >"$P/my-blob" && | ||||||
|  | 	git -C "$P" add my-blob && | ||||||
|  | 	git -C "$P" commit -m x && | ||||||
|  |  | ||||||
|  | 	configure_exclusion "$P" my-blob >h && | ||||||
|  |  | ||||||
|  | 	git init http_child && | ||||||
|  |  | ||||||
|  | 	GIT_TEST_SIDEBAND_ALL=1 \ | ||||||
|  | 	git -C http_child -c protocol.version=2 \ | ||||||
|  | 		-c fetch.uriprotocols=http,https \ | ||||||
|  | 		fetch "$HTTPD_URL/smart/http_parent" | ||||||
|  | ' | ||||||
|  |  | ||||||
| test_expect_success 'fetching with valid packfile URI but invalid hash fails' ' | test_expect_success 'fetching with valid packfile URI but invalid hash fails' ' | ||||||
| 	P="$HTTPD_DOCUMENT_ROOT_PATH/http_parent" && | 	P="$HTTPD_DOCUMENT_ROOT_PATH/http_parent" && | ||||||
| 	rm -rf "$P" http_child log && | 	rm -rf "$P" http_child log && | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano