Re: [PATCH v2 12/12] t0612: add tests to exercise Git/JGit reftable compatibility
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Apr 8, 2024, 07:10 UTC
- Message-ID
- <CAPig+cT3kvvHL+wLTFj58e5BnB7yBA=HD3C4vWC4zQhys3GCHA@mail.gmail.com>
- In-Reply-To
- <160b026e69547739a526fb6276a895904a4d33a8.1712555682.git.ps@pks.im>
On Mon, Apr 8, 2024 at 2:47 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 24 quoted lines
> While the reftable format is a recent introduction in Git, JGit already
> knows to read and write reftables since 2017. Given the complexity of
> the format there is a very real risk of incompatibilities between those
> two implementations, which is something that we really want to avoid.
>
> Add some basic tests that verify that reftables written by Git and JGit
> can be read by the respective other implementation. For now this test
> suite is rather small, only covering basic functionality. But it serves
> as a good starting point and can be extended over time.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> diff --git a/t/t0612-reftable-jgit-compatibility.sh b/t/t0612-reftable-jgit-compatibility.sh
> @@ -0,0 +1,132 @@
> +test_expect_success 'JGit can read multi-level index' '
> + ...
> + awk "
> + BEGIN {
> + print \"start\";
> + for (i = 0; i < 10000; i++)
> + printf \"create refs/heads/branch-%d HEAD\n\", i;
> + print \"commit\";
> + }
> + " >input &&I was going to suggest that you could accomplish this more easily directly in shell (without employing `awk`):
{
echo start &&
printf "create refs/heads/branch-%d HEAD\n" $(test_seq 0 9999) &&
echo commit
} >input &&but then I realized that that could potentially run afoul of command-line length limit on some platform due to the 0-9999 sequence.