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

Re: [PATCH v2 1/4] odb: use size_t for the length of objects to write

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 30, 2026, 11:44 UTC
Message-ID
<auSDFRHpLy65PMF_@pks.im>
In-Reply-To
<8fcb9f10f13962acd5cdac652bea8fc4164f2e78.1793352943.git.gitter.spiros@gmail.com>
On Fri, Oct 30, 2026 at 10:58:50AM +0100, Elia Pinto wrote:
Show 17 quoted lines
> diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
> index 463b38f990..0a89bbb455 100755
> --- a/t/t1007-hash-object.sh
> +++ b/t/t1007-hash-object.sh
> @@ -297,4 +297,17 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
>  	test_cmp expect actual
>  '
>  
> +test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
> +		'write filtered files over 4GB correctly' '
> +	{ test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
> +	test_oid large5GB >expect &&
> +	test_config filter.null-filter.clean "cat" &&
> +	echo "big filter=null-filter" >.gitattributes &&
> +	git hash-object -w -- big >actual &&
> +	test_cmp expect actual &&
> +	echo $((5*1024*1024*1024)) >expect &&
Isn't this the exact same as `big`? So...
> +	git cat-file -s $(cat actual) >actual &&

We shouldn't read from and write to the same file. Maybe write it to "actual.size" instead?

> +	test_cmp expect actual
> +'
... can't we `test_cmp big actual` here?
Also, it might make sense to use `test_cmp_bin ()` instead.
Patrick
Previous: Elia PintoNext: Elia Pinto
Message 10 of 24 in “use size_t for a few more object and buffer sizes”
  1. 0/3 use size_t for a few more object and buffer sizesElia Pinto, Oct 21, 2026
  2. 1/3 odb: use size_t for the length of objects to writeElia Pinto, Oct 21, 2026
  3. Patrick SteinhardtOct 21, 2026
  4. 2/3 diff: use size_t for the allocation size of word-diff buffersElia Pinto, Oct 21, 2026
  5. Patrick SteinhardtOct 21, 2026
  6. 3/3 convert: use size_t for buffer sizesElia Pinto, Oct 21, 2026
  7. Patrick SteinhardtOct 21, 2026
  8. 0/4 use size_t for a few more object and buffer sizesElia Pinto, Oct 30, 2026
  9. 1/4 odb: use size_t for the length of objects to writeElia Pinto, Oct 30, 2026
  10. Patrick SteinhardtOct 30, 2026
  11. Elia PintoOct 31, 2026
  12. 2/4 diff: use size_t for the allocation size of word-diff buffersElia Pinto, Oct 30, 2026
  13. 3/4 convert: use size_t for buffer sizesElia Pinto, Oct 30, 2026
  14. 4/4 convert: use size_t for text statistics and ident countsElia Pinto, Oct 30, 2026
  15. Patrick SteinhardtOct 30, 2026
  16. Elia PintoOct 31, 2026
  17. Patrick SteinhardtNov 2, 2026
  18. Junio C HamanoNov 2, 2026
  19. Patrick SteinhardtNov 3, 2026
  20. 0/4 use size_t for a few more object and buffer sizesElia Pinto, Oct 31, 2026
  21. 1/4 odb: use size_t for the length of objects to writeElia Pinto, Oct 31, 2026
  22. 2/4 diff: use size_t for the allocation size of word-diff buffersElia Pinto, Oct 31, 2026
  23. 3/4 convert: use size_t for buffer sizesElia Pinto, Oct 31, 2026
  24. 4/4 convert: use size_t for text statistics and ident countsElia Pinto, Oct 31, 2026

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.