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

Re: [PATCH v4 0/4] Optionally skip hashing index on write

From
Derrick Stolee <derrickstolee@github.com>
Date
Jan 6, 2023, 15:33 UTC
Message-ID
<b2164be2-72e9-cee5-26db-3e4fbfec3051@github.com>
In-Reply-To
<221216.86sfhf1gbc.gmgdl@evledraar.gmail.com>
On 12/16/2022 10:43 AM, Ævar Arnfjörð Bjarmason wrote:
> But as it is split up the individual steps should make sense. The 2/4
> here should really just use "bool", not "maybe_bool" to begin with, no?
Show 26 quoted lines
> And part of this in 4/4 is inheriting a non-stricture in
> repo-settings.c, but for this new config variable that we're introducing
> as only a boolean from day one can't we just die() on anything that's
> not a boolean?
> 
> On other implied feedback, in
> https://lore.kernel.org/git/221215.865yec3b1j.gmgdl@evledraar.gmail.com/
> I noted the switching between istate->repo & the_repository, and that
> you could hit a BUG() (when uncommenting a line in my testing patch on
> top) if we didn't have istate->repo:
> 
> There was a commit message update for that:
> 
>>  2:  00738c81a12 ! 2:  aae047cbc9f read-cache: add index.skipHash config option
>>      @@ Commit message
>>       
>>           [1] https://github.com/microsoft/git/commit/21fed2d91410f45d85279467f21d717a2db45201
>>       
>>      +    We load this config from the repository config given by istate->repo,
>>      +    with a fallback to the_repository if it is not set.
> 
> But I think that really sweeps a potential issue under the rug. What are
> these cases where we don't get istate->repo, are those expected? Is
> preferring istate->repo always known to be redundant now, and just done
> for good measure, or are there subtle cases (e.g. when reading
> submodules) where we pick the wrong repo's config?

After investigating some of the failures from creating a BUG() statement when istate->repo is NULL I see several problems, and they are not related to submodules for the most part.

The first issues I've found are due to code paths that operate on the_index without actually initializing it with a do_read_index(), or otherwise initialize an index using a memset() instead of a common initializer. This looks to be a frequent enough problem that solving it would require a significant effort. It's not a quick fix.

Show 5 quoted lines
> In that context I'd really like to see some testing of submodules in the
> added tests, i.e. does this act as we'd like it to when you set the
> config as "true" in the parent, but "false" in the submodule, & the
> other way around? That's a case that should stress this "the_repository"
> v.s. "istate->repo".

I can add a test for this, though we do not do that for every new config option. Further, we can only rely on commands like 'git add' that correctly initialize the index from a do_read_index(). It should be sufficient to use the index-local repository (when available) and trust that the repo_config_...() method is doing the right thing.

Show 12 quoted lines
> I really don't care per-se where we read the config, as long as it's
> doing what we expect from the UX point of view.
> 
> But in your
> https://lore.kernel.org/git/9e754af8-ecd3-6aed-60e8-2fc09a6a8759@github.com/
> you noted "There's no reason to load the config inside repo-settings.c
> unless it's part of something like feature.manyFiles.".
> 
> I think that's true, but on the flip side of that: Is there a reason to
> move the reading of such localized config (only needed in read-cache.c,
> as 2/4 shows) to repo-settings.c, just because it's now relying on the
> "manyfiles"?

Yes, because it makes it clear what options are part of these meta-config keys. It is better to centralize the parsing instead of having several different ad-hoc parsing strategies.

Thanks, -Stolee

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 47 of 59 in “Optionally skip hashing index on write”
  1. 0/4 Optionally skip hashing index on writeDerrick Stolee via GitGitGadget, Dec 7, 2022
  2. 2/4 read-cache: add index.skipHash config optionDerrick Stolee via GitGitGadget, Dec 7, 2022
  3. Eric SunshineDec 7, 2022
  4. Derrick StoleeDec 12, 2022
  5. Eric SunshineDec 12, 2022
  6. Ævar Arnfjörð BjarmasonDec 7, 2022
  7. Ævar Arnfjörð BjarmasonDec 7, 2022
  8. Junio C HamanoDec 8, 2022
  9. Derrick StoleeDec 12, 2022
  10. Ævar Arnfjörð BjarmasonDec 12, 2022
  11. 1/4 hashfile: allow skipping the hash functionDerrick Stolee via GitGitGadget, Dec 7, 2022
  12. Ævar Arnfjörð BjarmasonDec 7, 2022
  13. Jeff KingDec 8, 2022
  14. 3/4 test-lib-functions: add helper for trailing hashDerrick Stolee via GitGitGadget, Dec 7, 2022
  15. Ævar Arnfjörð BjarmasonDec 7, 2022
  16. Derrick StoleeDec 12, 2022
  17. 4/4 features: feature.manyFiles implies fast index writesDerrick Stolee via GitGitGadget, Dec 7, 2022
  18. Ævar Arnfjörð BjarmasonDec 7, 2022
  19. Derrick StoleeDec 12, 2022
  20. Ævar Arnfjörð BjarmasonDec 12, 2022
  21. Junio C HamanoDec 7, 2022
  22. Ævar Arnfjörð BjarmasonDec 7, 2022
  23. Derrick StoleeDec 8, 2022
  24. Jacob KellerDec 12, 2022
  25. 0/4 Optionally skip hashing index on writeDerrick Stolee via GitGitGadget, Dec 12, 2022
  26. 1/4 hashfile: allow skipping the hash functionDerrick Stolee via GitGitGadget, Dec 12, 2022
  27. 4/4 features: feature.manyFiles implies fast index writesDerrick Stolee via GitGitGadget, Dec 12, 2022
  28. 2/4 read-cache: add index.skipHash config optionDerrick Stolee via GitGitGadget, Dec 12, 2022
  29. 3/4 test-lib-functions: add helper for trailing hashDerrick Stolee via GitGitGadget, Dec 12, 2022
  30. SZEDER GáborDec 12, 2022
  31. Junio C HamanoDec 13, 2022
  32. SZEDER GáborDec 17, 2022
  33. 0/4 Optionally skip hashing index on writeDerrick Stolee via GitGitGadget, Dec 15, 2022
  34. 1/4 hashfile: allow skipping the hash functionDerrick Stolee via GitGitGadget, Dec 15, 2022
  35. 2/4 read-cache: add index.skipHash config optionDerrick Stolee via GitGitGadget, Dec 15, 2022
  36. Ævar Arnfjörð BjarmasonDec 15, 2022
  37. 3/4 test-lib-functions: add helper for trailing hashDerrick Stolee via GitGitGadget, Dec 15, 2022
  38. 4/4 features: feature.manyFiles implies fast index writesDerrick Stolee via GitGitGadget, Dec 15, 2022
  39. Ævar Arnfjörð BjarmasonDec 15, 2022
  40. Derrick StoleeDec 16, 2022
  41. 0/4 Optionally skip hashing index on writeDerrick Stolee via GitGitGadget, Dec 16, 2022
  42. 1/4 hashfile: allow skipping the hash functionDerrick Stolee via GitGitGadget, Dec 16, 2022
  43. 2/4 read-cache: add index.skipHash config optionDerrick Stolee via GitGitGadget, Dec 16, 2022
  44. 3/4 test-lib-functions: add helper for trailing hashDerrick Stolee via GitGitGadget, Dec 16, 2022
  45. 4/4 features: feature.manyFiles implies fast index writesDerrick Stolee via GitGitGadget, Dec 16, 2022
  46. Ævar Arnfjörð BjarmasonDec 16, 2022
  47. Derrick StoleeJan 6, 2023
  48. Junio C HamanoJan 6, 2023
  49. Derrick StoleeJan 6, 2023
  50. Ævar Arnfjörð BjarmasonJan 9, 2023
  51. Derrick StoleeJan 9, 2023
  52. Ævar Arnfjörð BjarmasonJan 9, 2023
  53. 0/4 Optionally skip hashing index on writeDerrick Stolee via GitGitGadget, Jan 6, 2023
  54. 1/4 hashfile: allow skipping the hash functionDerrick Stolee via GitGitGadget, Jan 6, 2023
  55. 2/4 read-cache: add index.skipHash config optionDerrick Stolee via GitGitGadget, Jan 6, 2023
  56. 3/4 test-lib-functions: add helper for trailing hashDerrick Stolee via GitGitGadget, Jan 6, 2023
  57. 4/4 features: feature.manyFiles implies fast index writesDerrick Stolee via GitGitGadget, Jan 6, 2023
  58. Junio C HamanoJan 15, 2023
  59. Derrick StoleeJan 17, 2023

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.