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

[PATCH 2/7] t5530: check protocol response for "not our ref"

From
Jeff King <peff@peff.net>
Date
Apr 13, 2019, 05:53 UTC
Message-ID
<20190413055309.GB19495@sigill.intra.peff.net>
In-Reply-To
<20190413055127.GA32340@sigill.intra.peff.net>

Back in 9f9aa76130 (upload-pack: Improve error message when bad ref requested, 2010-07-31), we added a test to make sure that we die with a sensible message when the client asks for an object we don't have.

Much later, in bdb31eada7 (upload-pack: report "not our ref" to client, 2017-02-23), we started reporting that information via an "ERR" line in the protocol. Let's check that part, as well.

While we're touching this test, let's drop the "-q" on the grep calls. Our usual test style just relies on --verbose to control output.

Signed-off-by: Jeff King <peff@peff.net>
---
If like me, you are scratching your head over the grep for
multi_ack_detailed, it is from 9f9aa76130, which made sure we did not
spew extra cruft as part of the die message.
 t/t5530-upload-pack-error.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 4f6e32b04c..295bd0c83c 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -62,8 +62,9 @@ test_expect_success 'upload-pack error message when bad ref requested' '
 	printf "0045want %s multi_ack_detailed\n00000009done\n0000" \
 		"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" >input &&
 	test_must_fail git upload-pack . <input >output 2>output.err &&
-	grep -q "not our ref" output.err &&
-	! grep -q multi_ack_detailed output.err
+	grep "not our ref" output.err &&
+	grep "ERR" output &&
+	! grep multi_ack_detailed output.err
 '
 
 test_expect_success 'upload-pack fails due to error in pack-objects enumeration' '
-- 
2.21.0.931.gd0bc72a411
Previous: Jeff KingNext: Jeff King
Message 3 of 9 in “some fetch reachability-error fixes”
  1. 0/7 some fetch reachability-error fixesJeff King, Apr 13, 2019
  2. 1/7 t5516: drop ok=sigpipe from unreachable-want testsJeff King, Apr 13, 2019
  3. 2/7 t5530: check protocol response for "not our ref"Jeff King, Apr 13, 2019
  4. 3/7 upload-pack: send ERR packet for non-tip objectsJeff King, Apr 13, 2019
  5. 4/7 pkt-line: prepare buffer before handling ERR packetsJeff King, Apr 13, 2019
  6. 5/7 fetch: use free_refs()Jeff King, Apr 13, 2019
  7. 6/7 remote.c: make singular free_ref() publicJeff King, Apr 13, 2019
  8. 7/7 fetch: do not consider peeled tags as advertised tipsJeff King, Apr 13, 2019
  9. Jonathan TanApr 15, 2019

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.