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

Re: [PATCH v4 7/7] refs/reftable: add fsck check for checking the table name

From
Karthik Nayak <karthik.188@gmail.com>
Date
Oct 6, 2025, 12:05 UTC
Message-ID
<CAOLa=ZRU01MQCLwWx4zEZNRtqNBvUJnMo8euE+J86q2a9adSwA@mail.gmail.com>
In-Reply-To
<aN5lrhCLQFnw7qUB@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 48 quoted lines
> On Fri, Sep 26, 2025 at 09:25:50AM +0200, Karthik Nayak wrote:
>> diff --git a/t/t0614-reftable-fsck.sh b/t/t0614-reftable-fsck.sh
>> new file mode 100755
>> index 0000000000..250d244e66
>> --- /dev/null
>> +++ b/t/t0614-reftable-fsck.sh
>> @@ -0,0 +1,38 @@
>> +#!/bin/sh
>> +
>> +test_description='Test reftable backend consistency check'
>> +
>> +GIT_TEST_DEFAULT_REF_FORMAT=reftable
>> +export GIT_TEST_DEFAULT_REF_FORMAT
>> +
>> +. ./test-lib.sh
>> +
>> +for TABLE_NAME in "foo-bar-e4d12d59.ref" \
>> +	"0x00000000zzzz-0x00000000zzzz-e4d12d59.ref" \
>> +	"0x000000000001-0x000000000002-e4d12d59.abc" \
>> +	"0x000000000001-0x000000000002-e4d12d59.refabc"; do
>> +	test_expect_success "table name $TABLE_NAME should be checked" '
>> +		test_when_finished "rm -rf repo" &&
>> +		git init repo &&
>> +		(
>> +			cd repo &&
>> +			git commit --allow-empty -m initial &&
>> +
>> +			git refs verify 2>err &&
>> +			test_must_be_empty err &&
>> +
>> +			EXISTING_TABLE=$(head -n1 .git/reftable/tables.list) &&
>> +			mv ".git/reftable/$EXISTING_TABLE" ".git/reftable/$TABLE_NAME" &&
>> +			sed "s/${EXISTING_TABLE}/${TABLE_NAME}/g" .git/reftable/tables.list > tables.list &&
>> +			mv tables.list .git/reftable/tables.list &&
>> +
>> +			git refs verify 2>err &&
>> +			cat >expect <<-EOF &&
>> +			warning: ${TABLE_NAME}: badReftableTableName: invalid reftable table name
>> +			EOF
>> +			test_cmp expect err
>> +		)
>> +	'
>> +done
>> +
>> +test_done
>
> Nit: we don't have any test that verifies that `git refs verify` doesn't
> complain with a well-formed stack.

The above test does run `git refs verify` on the repository before modifying the 'tables.list' file. Do you mean a stack with > 1 tables? I think that would be worthwhile. Let me do that.

Show 6 quoted lines
>
> Other than that this series looks good to me, thanks! I think we might
> want to have one final reroll, but once that's out I think this should
> be ready to be merged down.
>
> Patrick
Really appreciate the quick and thorough reviews.

Thanks, Karthik

Previous: Patrick SteinhardtNext: Junio C Hamano
Message 13 of 14 in “refs/reftable: add consistency checks”
  1. 0/7 refs/reftable: add consistency checksKarthik Nayak, Sep 26, 2025
  2. 1/7 refs: remove unused headersKarthik Nayak, Sep 26, 2025
  3. 2/7 refs: move consistency check msg to generic layerKarthik Nayak, Sep 26, 2025
  4. 3/7 reftable: check for trailing newline in 'tables.list'Karthik Nayak, Sep 26, 2025
  5. Patrick SteinhardtOct 2, 2025
  6. Karthik NayakOct 6, 2025
  7. 4/7 Documentation/fsck-msgids: remove duplicate msg idKarthik Nayak, Sep 26, 2025
  8. 5/7 fsck: order 'fsck_msg_type' alphabeticallyKarthik Nayak, Sep 26, 2025
  9. 6/7 reftable: add code to facilitate consistency checksKarthik Nayak, Sep 26, 2025
  10. Patrick SteinhardtOct 2, 2025
  11. 7/7 refs/reftable: add fsck check for checking the table nameKarthik Nayak, Sep 26, 2025
  12. Patrick SteinhardtOct 2, 2025
  13. Karthik NayakOct 6, 2025
  14. Junio C HamanoSep 26, 2025

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.