Merge branch 'jk/smart-http-hide-refs' into maint
The transfer.hiderefs support did not quite work for smart-http transport. * jk/smart-http-hide-refs: upload-pack: do not check NULL return of lookup_unknown_object upload-pack: fix transfer.hiderefs over smart-http
This commit is contained in:
		| @ -213,6 +213,17 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set | ||||
| 	test_cmp expect_cookies.txt cookies_tail.txt | ||||
| ' | ||||
|  | ||||
| test_expect_success 'transfer.hiderefs works over smart-http' ' | ||||
| 	test_commit hidden && | ||||
| 	test_commit visible && | ||||
| 	git push public HEAD^:refs/heads/a HEAD:refs/heads/b && | ||||
| 	git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \ | ||||
| 		config transfer.hiderefs refs/heads/a && | ||||
| 	git clone --bare "$HTTPD_URL/smart/repo.git" hidden.git && | ||||
| 	test_must_fail git -C hidden.git rev-parse --verify a && | ||||
| 	git -C hidden.git rev-parse --verify b | ||||
| ' | ||||
|  | ||||
| test_expect_success EXPENSIVE 'create 50,000 tags in the repo' ' | ||||
| 	( | ||||
| 	cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && | ||||
|  | ||||
| @ -681,7 +681,7 @@ static void receive_needs(void) | ||||
| } | ||||
|  | ||||
| /* return non-zero if the ref is hidden, otherwise 0 */ | ||||
| static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) | ||||
| static int mark_our_ref(const char *refname, const unsigned char *sha1) | ||||
| { | ||||
| 	struct object *o = lookup_unknown_object(sha1); | ||||
|  | ||||
| @ -689,12 +689,16 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag | ||||
| 		o->flags |= HIDDEN_REF; | ||||
| 		return 1; | ||||
| 	} | ||||
| 	if (!o) | ||||
| 		die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1)); | ||||
| 	o->flags |= OUR_REF; | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int check_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) | ||||
| { | ||||
| 	mark_our_ref(refname, sha1); | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static void format_symref_info(struct strbuf *buf, struct string_list *symref) | ||||
| { | ||||
| 	struct string_list_item *item; | ||||
| @ -713,7 +717,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo | ||||
| 	const char *refname_nons = strip_namespace(refname); | ||||
| 	unsigned char peeled[20]; | ||||
|  | ||||
| 	if (mark_our_ref(refname, sha1, flag, NULL)) | ||||
| 	if (mark_our_ref(refname, sha1)) | ||||
| 		return 0; | ||||
|  | ||||
| 	if (capabilities) { | ||||
| @ -767,8 +771,8 @@ static void upload_pack(void) | ||||
| 		advertise_shallow_grafts(1); | ||||
| 		packet_flush(1); | ||||
| 	} else { | ||||
| 		head_ref_namespaced(mark_our_ref, NULL); | ||||
| 		for_each_namespaced_ref(mark_our_ref, NULL); | ||||
| 		head_ref_namespaced(check_ref, NULL); | ||||
| 		for_each_namespaced_ref(check_ref, NULL); | ||||
| 	} | ||||
| 	string_list_clear(&symref, 1); | ||||
| 	if (advertise_refs) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Junio C Hamano
					Junio C Hamano