git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t5601: mark protocol v2-only test
@ 2021-05-04 22:34 Jonathan Tan
  2021-05-05  1:12 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Tan @ 2021-05-04 22:34 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, lilinchao, stolee

A HTTP-clone test introduced in 4fe788b1b0 ("builtin/clone.c: add
--reject-shallow option", 2021-04-01) only works in protocol v2, but is
not marked as such.

The aforementioned patch implements --reject-shallow for a variety of
situations, but usage of a protocol that requires a remote helper is not
one of them. (Such an implementation would require extending the remote
helper protocol to support the passing of a "reject shallow" option, and
then teaching it to both protocol-speaking ends.)

For now, to make it pass when GIT_TEST_PROTOCOL_VERSION=0 is passed, add
"-c protocol.version=2". A more complete solution would be either to
augment the remote helper protocol to support this feature or to return
a fatal error when using --reject-shallow with a protocol that uses a
remote helper.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
I think the remote helper solution can be done by adding an "option"
(something that can be passed using the "option" command). We have
options for things like "from-promisor", for example. I haven't looked
into this in detail, though.
---
 t/t5601-clone.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 329ae599fd..c0688467e7 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -762,7 +762,7 @@ test_expect_success 'partial clone using HTTP' '
 test_expect_success 'reject cloning shallow repository using HTTP' '
 	test_when_finished "rm -rf repo" &&
 	git clone --bare --no-local --depth=1 src "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	test_must_fail git clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err &&
+	test_must_fail git -c protocol.version=2 clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err &&
 	test_i18ngrep -e "source repository is shallow, reject to clone." err &&
 
 	git clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo
-- 
2.31.1.527.g47e6f16901-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] t5601: mark protocol v2-only test
  2021-05-04 22:34 [PATCH] t5601: mark protocol v2-only test Jonathan Tan
@ 2021-05-05  1:12 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2021-05-05  1:12 UTC (permalink / raw)
  To: Jonathan Tan; +Cc: git, lilinchao, stolee

Jonathan Tan <jonathantanmy@google.com> writes:

> A HTTP-clone test introduced in 4fe788b1b0 ("builtin/clone.c: add
> --reject-shallow option", 2021-04-01) only works in protocol v2, but is
> not marked as such.
>
> The aforementioned patch implements --reject-shallow for a variety of
> situations, but usage of a protocol that requires a remote helper is not
> one of them. (Such an implementation would require extending the remote
> helper protocol to support the passing of a "reject shallow" option, and
> then teaching it to both protocol-speaking ends.)
>
> For now, to make it pass when GIT_TEST_PROTOCOL_VERSION=0 is passed, add
> "-c protocol.version=2". A more complete solution would be either to
> augment the remote helper protocol to support this feature or to return
> a fatal error when using --reject-shallow with a protocol that uses a
> remote helper.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> I think the remote helper solution can be done by adding an "option"
> (something that can be passed using the "option" command). We have
> options for things like "from-promisor", for example. I haven't looked
> into this in detail, though.

Sounds like a good direction to go in.  In the meantime, certainly
this will work around the issue in the original test.

Will queue---thanks.


>  t/t5601-clone.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
> index 329ae599fd..c0688467e7 100755
> --- a/t/t5601-clone.sh
> +++ b/t/t5601-clone.sh
> @@ -762,7 +762,7 @@ test_expect_success 'partial clone using HTTP' '
>  test_expect_success 'reject cloning shallow repository using HTTP' '
>  	test_when_finished "rm -rf repo" &&
>  	git clone --bare --no-local --depth=1 src "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
> -	test_must_fail git clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err &&
> +	test_must_fail git -c protocol.version=2 clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err &&
>  	test_i18ngrep -e "source repository is shallow, reject to clone." err &&
>  
>  	git clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-05  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 22:34 [PATCH] t5601: mark protocol v2-only test Jonathan Tan
2021-05-05  1:12 ` Junio C Hamano

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git