Re: [PATCH] t1010: add basic tests for mktree --batch
- From
- Laveesh Bansal <laveeshb@laveeshbansal.com>
- Date
- Nov 9, 2026, 23:12 UTC
- Message-ID
- <20261109231200.55724-1-laveeshb@laveeshbansal.com>
- In-Reply-To
- <pull.2270.git.1792497283164.gitgitgadget@gmail.com>
Roger Koranteng <rogerkorantenng@gmail.com> writes:
Show 7 quoted lines
> The only "mktree --batch" test in t1010 is the one checking that it > survives a concurrent repack. Nothing covers basic batch mode, which > is how the leak fixed in 6272f3bd17 (mktree: plug per-tree leak in > --batch mode, 2026-08-29) went unnoticed. > > Add a few tests for it. Two trees in one batch should get the same > [...]
Thanks for adding these. t1010 passes for me with the patch, also under SANITIZE=leak. With 6272f3bd17 reverted, tests 10, 11, 12 and 14 each fail when run on their own, so they do catch that leak.
> One test feeds two blank lines in a row and expects an empty tree in > between. That is what mktree does today, but the documentation says > trees are separated by "a single blank line", so I am not sure it is > intended. The test records the current behaviour.
I would keep this test. The question about the documentation fits better below the "---" than in the commit message.
> +test_expect_success 'mktree --batch stops at a tree with a missing object' ' > [...] > + test_must_fail git mktree --batch <input >actual && > + test_cmp tree actual
Capturing stderr and checking for the "is unavailable" message would make sure it died for the expected reason:
test_must_fail git mktree --batch <input >actual 2>err && test_cmp tree actual && test_grep "object $missing is unavailable" err
Tested-by: Laveesh Bansal <laveeshb@laveeshbansal.com>