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

Re: [PATCH v3 20/25] refs: RFC: Reftable support for git-core

From
Han-Wen Nienhuys <hanwen@google.com>
Date
Aug 30, 2021, 13:31 UTC
Message-ID
<CAFQ2z_OTdXSvPcjPRi8fx6F_yjwiL3vRpPtnEOTyaeBxMB2wHQ@mail.gmail.com>
In-Reply-To
<871r6kh3m8.fsf@evledraar.gmail.com>

On Mon, Aug 23, 2021 at 12:12 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

> Elsewhere in this series we use the ARRAY_SIZE() macro from
> git-compat-util.h, can't we also use REALLOC_ARRAY() from the same
> header here?
Done.
Show 11 quoted lines
> > [...]
> > +     if (!(flags & EXPIRE_REFLOGS_DRY_RUN)) {
> > +             /* XXX - skip writing records that were not changed. */
> > +             err = reftable_addition_commit(add);
> > +     } else {
> > +             /* XXX - print something */
> > +     }
>
> Aren't these comments covered by some of the failing tests under
> GIT_TEST_REFTABLE=true? I.e. what I mentioned
> https://lore.kernel.org/git/877dgch4rn.fsf@evledraar.gmail.com/

The XXX comments are directed at reviewers. I don't know if these places relate to test failures.

Show 13 quoted lines
> > [...]
> > +     if (err < 0) {
> > +             errno = reftable_error_to_errno(err);
> > +             err = -1;
> > +             goto done;
> > +     }
>
> In your proposed fixup for the merger of our topics in
> https://lore.kernel.org/git/pull.1054.v3.git.git.1629207607.gitgitgadget@gmail.com/
> you have the call to reftable_error_to_errno() here deleted, so isn't
> this also redundant at this point (and then the
> reftable_error_to_errno() function can be deleted), or is this errno
> setting still needed with some of my changes?

No; it's purely informational, but the errno codes aren't a good match, so OK to drop as well.

> Can't later tests just use "main" instead of primary with a
> GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main, then we can drop this
> "git_init" wrapper?
Done.
> > +initialize ()  {
> > +     rm -rf .git &&
>
> Should instead set up a test_when_finished "rm -rf .git" ?

No. The test framework sets up a scratch repo, but the scratch repo doesn't use reftable, so it interferes with the tests.

Show 7 quoted lines
> > +     (GIT_TEST_REFTABLE=1; export GIT_TEST_REFTABLE; git_init) &&
>
> This export before calling git_init can surely go away if git_init goes,
> but alo why export beforehand here, but in later tests in this file we
> just do a plain:
>
>     (GIT_TEST_REFTABLE=1 git_init) &&
Done.
Show 6 quoted lines
> > +     mv .git/hooks .git/hooks-disabled
>
> Is this "mv" cargo-culted from what test_create_repo() used to do before
> my-f0d4d398e28 (test-lib: split up and deprecate test_create_repo(),
> 2021-05-10)? In any case templated hooks are disabled by default (named
> *.sample), so I don't think this is needed.
Done.
> > +     echo hoi >> file.t &&
>
> Nit: >>file.t, not ">> file.t".
Dnoe.
Show 5 quoted lines
> > +     git show-ref | sed s/before/after/g > expected &&
>
> Don't have "git" on the LHS of a pipe, it'll hide a segfault. Should use
> a temporary file. Also "s/ > />/g" like above (and in some places below,
> will stop noting it...).
Done.
Show 13 quoted lines
> > +test_expect_success 'SHA256 support, env' '
> > +     rm -rf .git &&
> > +     GIT_DEFAULT_HASH=sha256 && export GIT_DEFAULT_HASH &&
> > +     (GIT_TEST_REFTABLE=1 git_init) &&
> > +     mv .git/hooks .git/hooks-disabled &&
>
> Comments about this .git/hooks-disabled not being needed aside, this
> seems to be duplicating the initialize() function. I.e. should we not
> skip the "rm -rf" and "mv" here, and just set GIT_DEFAULT_HASH=sha256
> and call initialize?
>
> (Better yet, if we get rid of that "git init" wrapper as I noted above,
> this can just be an argument to "git init", no?
Done.
Show 7 quoted lines
>
> > [...]
> > +     rm -rf .git &&
> > +     (GIT_TEST_REFTABLE=1 git_init --object-format=sha256) &&
> > +     mv .git/hooks .git/hooks-disabled &&
>
> ditto.
done.
> > +     ! git update-ref -d refs/tags/file $INVALID_SHA1 &&
>
> Always "test_must_fail git", not "! git".
done.
Show 42 quoted lines
>
> > [...]
> > +test_expect_success 'clone calls transaction_initial_commit' '
> > +     test_commit message1 file1 &&
> > +     git clone . cloned &&
> > +     (test  -f cloned/file1 || echo "Fixme.")
>
> So this test really tests nothing much, and we should skip the "Fixme"
> here and have this be test_expect_failure() or something instead?
>
> > [...]
> > +     git show-ref | cut -f2 -d" " >actual &&
>
> Git on LHS of a pipe again.
>
> > +# This matches show-ref's output
> > +print_ref() {
> > +     echo "$(git rev-parse "$1") $1"
> > +}
> > +
> > +test_expect_success 'peeled tags are stored' '
> > +     initialize &&
> > +     test_commit file &&
> > +     git tag -m "annotated tag" test_tag HEAD &&
> > +     {
> > +             print_ref "refs/heads/primary" &&
> > +             print_ref "refs/tags/file" &&
> > +             print_ref "refs/tags/test_tag" &&
> > +             print_ref "refs/tags/test_tag^{}"
> > +     } >expect &&
>
> Maybe I'm missing something, but wouldn't this print_ref() helper be
> better as a "git for-each-ref --format" of some sort?
>
> > [...]
> > +. "$TEST_DIRECTORY"/lib-httpd.sh
> > +start_httpd
> > +
> > +REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo"
>
> Let's split these httpd-needing tests into another test file, see
> https://lore.kernel.org/git/87bl753i2p.fsf@evledraar.gmail.com/ for why.
done.
-- 
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 77 of 132 in “Support reftable ref backend for Git”
  1. 00/26 Support reftable ref backend for GitHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  2. 01/26 hash.h: provide constants for the hash IDsHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  3. 02/26 init-db: set the_repository->hash_algo early onHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  4. 03/26 reftable: RFC: add LICENSEHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  5. 06/26 reftable: add blocksource, an abstraction for random access readsHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  6. 04/26 reftable: add error related functionalityHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  7. 05/26 reftable: utility functionsHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  8. 08/26 Provide zlib's uncompress2 from compat/zlib-compat.cHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  9. 07/26 reftable: (de)serialization for the polymorphic record type.Han-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  10. 10/26 reftable: a generic binary tree implementationHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  11. 13/26 reftable: read reftable filesHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  12. 15/26 reftable: add a heap-based priority queue for reftable recordsHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  13. 09/26 reftable: reading/writing blocksHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  14. 12/26 reftable: generic interface to tablesHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  15. 14/26 reftable: reftable file level testsHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  16. 11/26 reftable: write reftable filesHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  17. 19/26 reftable: add dump utilityHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  18. 17/26 reftable: implement refname validationHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  19. 16/26 reftable: add merged table viewHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  20. 20/26 refs: RFC: Reftable support for git-coreHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  21. 24/26 t1401,t2011: parameterize HEAD.lock for REFFILESHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  22. 23/26 t1301: document what needs to be done for reftableHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  23. 26/26 t7004: avoid direct filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  24. 25/26 t1404: annotate test cases with REFFILESHan-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  25. 21/26 git-prompt: prepare for reftable refs backendSZEDER Gábor via GitGitGadget, Jul 20, 2021
  26. 18/26 reftable: implement stack, a mutable database of reftable files.Han-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  27. 22/26 Add "test-tool dump-reftable" command.Han-Wen Nienhuys via GitGitGadget, Jul 20, 2021
  28. 00/25 Support reftable ref backend for GitHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  29. 01/25 hash.h: provide constants for the hash IDsHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  30. 02/25 init-db: set the_repository->hash_algo early onHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  31. 03/25 reftable: RFC: add LICENSEHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  32. 04/25 reftable: add error related functionalityHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  33. 05/25 reftable: utility functionsHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  34. 06/25 reftable: add blocksource, an abstraction for random access readsHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  35. 08/25 Provide zlib's uncompress2 from compat/zlib-compat.cHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  36. 07/25 reftable: (de)serialization for the polymorphic record type.Han-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  37. Carlo Marcelo Arenas BelónAug 16, 2021
  38. Han-Wen NienhuysAug 17, 2021
  39. 09/25 reftable: reading/writing blocksHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  40. 10/25 reftable: a generic binary tree implementationHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  41. 11/25 reftable: write reftable filesHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  42. 12/25 reftable: generic interface to tablesHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  43. 13/25 reftable: read reftable filesHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  44. 14/25 reftable: reftable file level testsHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  45. 15/25 reftable: add a heap-based priority queue for reftable recordsHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  46. 16/25 reftable: add merged table viewHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  47. 17/25 reftable: implement refname validationHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  48. 18/25 reftable: implement stack, a mutable database of reftable files.Han-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  49. 19/25 reftable: add dump utilityHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  50. 21/25 git-prompt: prepare for reftable refs backendSZEDER Gábor via GitGitGadget, Aug 16, 2021
  51. 20/25 refs: RFC: Reftable support for git-coreHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  52. 22/25 Add "test-tool dump-reftable" command.Han-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  53. 23/25 t1301: document what needs to be done for reftableHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  54. 24/25 t1401,t2011: parameterize HEAD.lock for REFFILESHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  55. 25/25 t1404: annotate test cases with REFFILESHan-Wen Nienhuys via GitGitGadget, Aug 16, 2021
  56. Junio C HamanoAug 16, 2021
  57. Han-Wen NienhuysAug 17, 2021
  58. 00/25 Support reftable ref backend for GitHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  59. 01/25 hash.h: provide constants for the hash IDsHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  60. Ævar Arnfjörð BjarmasonAug 23, 2021
  61. 06/25 reftable: add blocksource, an abstraction for random access readsHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  62. 08/25 Provide zlib's uncompress2 from compat/zlib-compat.cHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  63. Philip OakleyAug 18, 2021
  64. Han-Wen NienhuysAug 18, 2021
  65. Philip OakleyAug 18, 2021
  66. 09/25 reftable: reading/writing blocksHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  67. 05/25 reftable: utility functionsHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  68. 03/25 reftable: RFC: add LICENSEHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  69. 04/25 reftable: add error related functionalityHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  70. 12/25 reftable: generic interface to tablesHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  71. 07/25 reftable: (de)serialization for the polymorphic record type.Han-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  72. 11/25 reftable: write reftable filesHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  73. 10/25 reftable: a generic binary tree implementationHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  74. 21/25 git-prompt: prepare for reftable refs backendSZEDER Gábor via GitGitGadget, Aug 17, 2021
  75. 20/25 refs: RFC: Reftable support for git-coreHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  76. Ævar Arnfjörð BjarmasonAug 23, 2021
  77. Han-Wen NienhuysAug 30, 2021
  78. Ævar Arnfjörð BjarmasonAug 30, 2021
  79. 19/25 reftable: add dump utilityHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  80. 15/25 reftable: add a heap-based priority queue for reftable recordsHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  81. 13/25 reftable: read reftable filesHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  82. 25/25 t1404: annotate test cases with REFFILESHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  83. 16/25 reftable: add merged table viewHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  84. 18/25 reftable: implement stack, a mutable database of reftable files.Han-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  85. 24/25 t1401,t2011: parameterize HEAD.lock for REFFILESHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  86. 22/25 Add "test-tool dump-reftable" command.Han-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  87. 17/25 reftable: implement refname validationHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  88. 23/25 t1301: document what needs to be done for reftableHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  89. 14/25 reftable: reftable file level testsHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  90. 02/25 init-db: set the_repository->hash_algo early onHan-Wen Nienhuys via GitGitGadget, Aug 17, 2021
  91. Ævar Arnfjörð BjarmasonAug 23, 2021
  92. Ævar Arnfjörð BjarmasonAug 26, 2021
  93. 00/28 Support reftable ref backend for GitÆvar Arnfjörð Bjarmason, Aug 23, 2021
  94. 01/28 hash.h: provide constants for the hash IDsÆvar Arnfjörð Bjarmason, Aug 23, 2021
  95. 02/28 init-db: set the_repository->hash_algo early onÆvar Arnfjörð Bjarmason, Aug 23, 2021
  96. 03/28 reftable: RFC: add LICENSEÆvar Arnfjörð Bjarmason, Aug 23, 2021
  97. 04/28 reftable: add error related functionalityÆvar Arnfjörð Bjarmason, Aug 23, 2021
  98. 05/28 reftable: utility functionsÆvar Arnfjörð Bjarmason, Aug 23, 2021
  99. 06/28 reftable: add blocksource, an abstraction for random access readsÆvar Arnfjörð Bjarmason, Aug 23, 2021
  100. 07/28 reftable: (de)serialization for the polymorphic record type.Ævar Arnfjörð Bjarmason, Aug 23, 2021
  101. 08/28 Provide zlib's uncompress2 from compat/zlib-compat.cÆvar Arnfjörð Bjarmason, Aug 23, 2021
  102. 09/28 reftable: reading/writing blocksÆvar Arnfjörð Bjarmason, Aug 23, 2021
  103. 10/28 reftable: a generic binary tree implementationÆvar Arnfjörð Bjarmason, Aug 23, 2021
  104. 12/28 reftable: generic interface to tablesÆvar Arnfjörð Bjarmason, Aug 23, 2021
  105. 13/28 reftable: read reftable filesÆvar Arnfjörð Bjarmason, Aug 23, 2021
  106. 14/28 reftable: reftable file level testsÆvar Arnfjörð Bjarmason, Aug 23, 2021
  107. 15/28 reftable: add a heap-based priority queue for reftable recordsÆvar Arnfjörð Bjarmason, Aug 23, 2021
  108. 16/28 reftable: add merged table viewÆvar Arnfjörð Bjarmason, Aug 23, 2021
  109. 17/28 reftable: implement refname validationÆvar Arnfjörð Bjarmason, Aug 23, 2021
  110. 19/28 reftable: add dump utilityÆvar Arnfjörð Bjarmason, Aug 23, 2021
  111. 18/28 reftable: implement stack, a mutable database of reftable files.Ævar Arnfjörð Bjarmason, Aug 23, 2021
  112. Junio C HamanoAug 27, 2021
  113. reftable: fixup for broken __FUNCTION__ useÆvar Arnfjörð Bjarmason, Aug 27, 2021
  114. Carlo ArenasAug 27, 2021
  115. Han-Wen NienhuysAug 30, 2021
  116. 21/28 git-prompt: prepare for reftable refs backendÆvar Arnfjörð Bjarmason, Aug 23, 2021
  117. 20/28 refs: RFC: Reftable support for git-coreÆvar Arnfjörð Bjarmason, Aug 23, 2021
  118. 22/28 Add "test-tool dump-reftable" command.Ævar Arnfjörð Bjarmason, Aug 23, 2021
  119. 23/28 t1301: document what needs to be done for reftableÆvar Arnfjörð Bjarmason, Aug 23, 2021
  120. 26/28 reftable: fixup for new base topic 1/3Ævar Arnfjörð Bjarmason, Aug 23, 2021
  121. 25/28 t1404: annotate test cases with REFFILESÆvar Arnfjörð Bjarmason, Aug 23, 2021
  122. 24/28 t1401,t2011: parameterize HEAD.lock for REFFILESÆvar Arnfjörð Bjarmason, Aug 23, 2021
  123. 27/28 reftable: fixup for new base topic 2/3Ævar Arnfjörð Bjarmason, Aug 23, 2021
  124. Han-Wen NienhuysAug 30, 2021
  125. Ævar Arnfjörð BjarmasonAug 30, 2021
  126. Han-Wen NienhuysAug 30, 2021
  127. Ævar Arnfjörð BjarmasonAug 30, 2021
  128. 28/28 reftable: fixup for new base topic 3/3Ævar Arnfjörð Bjarmason, Aug 23, 2021
  129. 11/28 reftable: write reftable filesÆvar Arnfjörð Bjarmason, Aug 23, 2021
  130. Junio C HamanoAug 26, 2021
  131. Han-Wen NienhuysAug 26, 2021
  132. Junio C HamanoAug 26, 2021

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.