Subject: [PATCH 2/2] t5703: add test for shallow fetch with ref-in-want

From: Matthew Dodd <[email-masked]>
Date: Wed, 24 Dec 2025 01:35:04 +0100

From: Mats-Dodd <[email-masked]>

Add a regression test for shallow clone operations when the server has
uploadpack.allowRefInWant enabled. Before the previous commit, this
operation would fail with:

    fatal: expected 'packfile', received 'shallow-info'

This was due to the server sending protocol v2 sections in the wrong
order. The test ensures this scenario continues to work.

Signed-off-by: Mats-Dodd <[email-masked]>
---
 t/t5703-upload-pack-ref-in-want.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
index 249137b467..21f4049eb4 100755
--- a/t/t5703-upload-pack-ref-in-want.sh
+++ b/t/t5703-upload-pack-ref-in-want.sh
@@ -256,6 +256,15 @@ test_expect_success 'fetching multiple refs' '
 	grep "want-ref refs/heads/baz" log
 '
 
+test_expect_success 'fetching with ref-in-want and shallow' '
+	rm -rf local &&
+	git -c protocol.version=2 clone --depth=1 "file://$REPO" local &&
+
+	git -C "$REPO" rev-parse main >expected &&
+	git -C local rev-parse refs/remotes/origin/main >actual &&
+	test_cmp expected actual
+'
+
 test_expect_success 'fetching ref and exact OID' '
 	test_when_finished "rm -f log" &&
 
-- 
2.47.0