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

Re: [PATCH v4 1/2] cat-file: extract printing batch error message into function

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2023, 23:14 UTC
Message-ID
<xmqqilfhctrr.fsf@gitster.g>
In-Reply-To
<xmqqcz5peg3v.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> As batch_object_cb() makes a call to batch_object_write() with
> obj_name set to NULL, I do not think this change is defensible,
> though.

This indeed seems to break t5313 when queued on top of 'master'; it tries to run "git cat-file --batch-all-objects --batch-check" and hits the exact codepath where a missing object is sent to the error codepath without obj_name set to anything.

I guess we now have an existing test that you can mimic that exhibits "missing" error? I do not know offhand if this test already qualifies as the test coverage Phillip wanted to make sure exists.

..... >8 .......... >8 .......... >8 .......... >8 .......... >8 .....
expecting success of 5313.3 'pack/index object count mismatch': 
	do_pack $object &&
	munge $pack 8 "\377\0\0\0" &&
	clear_base &&
	# We enumerate the objects from the completely-fine
	# .idx, but notice later that the .pack is bogus
	# and fail to show any data.
	echo "$object missing" >expect &&
	git cat-file --batch-all-objects --batch-check >actual &&
	test_cmp expect actual &&
	# ...and here fail to load the object (without segfaulting),
	# but fallback to a good copy if available.
	test_must_fail git cat-file blob $object &&
	restore_base &&
	git cat-file blob $object >actual &&
	test_cmp file actual &&
	# ...and make sure that index-pack --verify, which has its
	# own reading routines, does not segfault.
	test_must_fail git index-pack --verify $pack

4+0 records in 4+0 records out 4 bytes copied, 0.000119221 s, 33.6 kB/s error: packfile .git/objects/pack/pack-67be769e2843d598c78218852612520795998892.pack claims to have 4278190080 objects while index indicates 1 objects error: packfile .git/objects/pack/pack-67be769e2843d598c78218852612520795998892.pack claims to have 4278190080 objects while index indicates 1 objects --- expect 2023-03-03 23:11:37.504011940 +0000 +++ actual 2023-03-03 23:11:37.508012250 +0000

@@ -1 +1 @@
-fff0a2476aa5c8e60a3ef21cfc66e0cc670920be missing
+(null) missing
not ok 3 - pack/index object count mismatch
Previous: Junio C HamanoNext: Toon Claes
Message 23 of 32 in “cat-file: quote-format name in error when using -z”
  1. 0/1 cat-file: quote-format name in error when using -zToon Claes, Dec 9, 2022
  2. 1/1 cat-file: quote-format name in error when using -zToon Claes, Dec 9, 2022
  3. Phillip WoodDec 9, 2022
  4. Junio C HamanoDec 9, 2022
  5. Phillip WoodDec 11, 2022
  6. Junio C HamanoDec 12, 2022
  7. Toon ClaesDec 12, 2022
  8. Junio C HamanoDec 12, 2022
  9. Phillip WoodDec 13, 2022
  10. Junio C HamanoDec 14, 2022
  11. Toon ClaesDec 20, 2022
  12. Phillip WoodDec 20, 2022
  13. Toon ClaesDec 21, 2022
  14. 0/1 cat-file: quote-format name in error when using -zToon Claes, Jan 5, 2023
  15. 1/1 cat-file: quote-format name in error when using -zToon Claes, Jan 5, 2023
  16. 0/1 cat-file: quote-format name in error when using -zToon Claes, Jan 16, 2023
  17. 1/1 cat-file: quote-format name in error when using -zToon Claes, Jan 16, 2023
  18. Phillip WoodJan 17, 2023
  19. 0/2 cat-file: quote-format name in error when using -zToon Claes, Mar 3, 2023
  20. 2/2 cat-file: quote-format name in error when using -zToon Claes, Mar 3, 2023
  21. 1/2 cat-file: extract printing batch error message into functionToon Claes, Mar 3, 2023
  22. Junio C HamanoMar 3, 2023
  23. Junio C HamanoMar 3, 2023
  24. 0/1 cat-file: quote-format name in error when using -zToon Claes, May 10, 2023
  25. 1/1 cat-file: quote-format name in error when using -zToon Claes, May 10, 2023
  26. Junio C HamanoMay 10, 2023
  27. Toon ClaesMay 12, 2023
  28. Junio C HamanoMay 12, 2023
  29. Phillip WoodMay 15, 2023
  30. Junio C HamanoMay 15, 2023
  31. Phillip WoodJun 2, 2023
  32. Junio C HamanoMar 3, 2023

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.