git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
MDMatthew Dodd <mats.dodd12@gmail.com>
Date
Dec 24, 2025, 00:35 UTC
Message-ID
<20251224003504.52660-3-mats.dodd12@gmail.com>
In-Reply-To
<20251224003504.52660-1-mats.dodd12@gmail.com>
From: Mats-Dodd <mats.dodd12@gmail.com>

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 <mats.dodd12@gmail.com>
---
 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
Previous: Patrick Steinhardt
Message 4 of 4 in “Fix shallow clone with ref-in-want enabled”
  1. 0/2 Fix shallow clone with ref-in-want enabledMatthew Dodd, Dec 24, 2025
  2. 1/2 upload-pack: send shallow-info before wanted-refs in protocol v2Matthew Dodd, Dec 24, 2025
  3. Patrick SteinhardtJan 5, 2026
  4. 2/2 t5703: add test for shallow fetch with ref-in-wantMatthew Dodd, Dec 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.