diff mbox series

t5606: run clone branch name test with protocol v2

Message ID 20210317154200.2656837-1-jonathantanmy@google.com (mailing list archive)
State Accepted
Commit c61dd431c34eab4b7886c190d0eb715ef4419ec9
Headers show
Series t5606: run clone branch name test with protocol v2 | expand

Commit Message

Jonathan Tan March 17, 2021, 3:42 p.m. UTC
4f37d45706 ("clone: respect remote unborn HEAD", 2021-02-05) introduces
a new feature (if the remote has an unborn HEAD, e.g. when the remote
repository is empty, use it as the name of the branch) that only works
in protocol v2, but did not ensure that one of its tests always uses
protocol v2, and thus that test would fail if
GIT_TEST_PROTOCOL_VERSION=0 (or 1) is used. Therefore, add "-c
protocol.version=2" to the appropriate test.

(The rest of the tests from that commit have "-c protocol.version=2"
already added.)

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
Thanks, Son Luong, for noticing this. Here's a fix for the
GIT_TEST_PROTOCOL_VERSION part. This was built on 4f37d45706 but also
applies cleanly on master.

 t/t5606-clone-options.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff King March 17, 2021, 5:42 p.m. UTC | #1
On Wed, Mar 17, 2021 at 08:42:00AM -0700, Jonathan Tan wrote:

> 4f37d45706 ("clone: respect remote unborn HEAD", 2021-02-05) introduces
> a new feature (if the remote has an unborn HEAD, e.g. when the remote
> repository is empty, use it as the name of the branch) that only works
> in protocol v2, but did not ensure that one of its tests always uses
> protocol v2, and thus that test would fail if
> GIT_TEST_PROTOCOL_VERSION=0 (or 1) is used. Therefore, add "-c
> protocol.version=2" to the appropriate test.
> 
> (The rest of the tests from that commit have "-c protocol.version=2"
> already added.)

Thanks, this looks like the obvious and correct fix (and clearly makes
the test pass ;) ).

-Peff
Junio C Hamano March 17, 2021, 6:18 p.m. UTC | #2
Jonathan Tan <jonathantanmy@google.com> writes:

> 4f37d45706 ("clone: respect remote unborn HEAD", 2021-02-05) introduces
> a new feature (if the remote has an unborn HEAD, e.g. when the remote
> repository is empty, use it as the name of the branch) that only works
> in protocol v2, but did not ensure that one of its tests always uses
> protocol v2, and thus that test would fail if
> GIT_TEST_PROTOCOL_VERSION=0 (or 1) is used. Therefore, add "-c
> protocol.version=2" to the appropriate test.
>
> (The rest of the tests from that commit have "-c protocol.version=2"
> already added.)
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> Thanks, Son Luong, for noticing this. Here's a fix for the
> GIT_TEST_PROTOCOL_VERSION part. This was built on 4f37d45706 but also
> applies cleanly on master.

Makes sense.  And I do not see need for any other changes, like
test_expect_failure with protocol 0 (or 1).

Will queue as a candidate for maint-2.31.

Thanks.



>
>  t/t5606-clone-options.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
> index ca6339a5fb..5e30772735 100755
> --- a/t/t5606-clone-options.sh
> +++ b/t/t5606-clone-options.sh
> @@ -106,7 +106,7 @@ test_expect_success 'chooses correct default initial branch name' '
>  	git -c init.defaultBranch=foo init --bare empty &&
>  	test_config -C empty lsrefs.unborn advertise &&
>  	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
> -	git -c init.defaultBranch=up clone empty whats-up &&
> +	git -c init.defaultBranch=up -c protocol.version=2 clone empty whats-up &&
>  	test refs/heads/foo = $(git -C whats-up symbolic-ref HEAD) &&
>  	test refs/heads/foo = $(git -C whats-up config branch.foo.merge)
>  '
diff mbox series

Patch

diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
index ca6339a5fb..5e30772735 100755
--- a/t/t5606-clone-options.sh
+++ b/t/t5606-clone-options.sh
@@ -106,7 +106,7 @@  test_expect_success 'chooses correct default initial branch name' '
 	git -c init.defaultBranch=foo init --bare empty &&
 	test_config -C empty lsrefs.unborn advertise &&
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
-	git -c init.defaultBranch=up clone empty whats-up &&
+	git -c init.defaultBranch=up -c protocol.version=2 clone empty whats-up &&
 	test refs/heads/foo = $(git -C whats-up symbolic-ref HEAD) &&
 	test refs/heads/foo = $(git -C whats-up config branch.foo.merge)
 '