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

Re: [PATCH v5 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 31, 2026, 09:27 UTC
Message-ID
<apVJAzddTPPCI7kA@pks.im>
In-Reply-To
<CALnO6CBejkZTgPM9tK6TEGeNYSRfi9r2-xi7R4ckTsRm4ZGaQw@mail.gmail.com>
On Sun, Aug 30, 2026 at 08:27:13PM -0400, D. Ben Knoble wrote:
Show 35 quoted lines
> On Sun, Aug 30, 2026 at 5:15 PM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > "D. Ben Knoble" <ben.knoble@gmail.com> writes:
> >
> > > +             /* nanosecond timestamped files can also be racy! */
> > > +             (repo_config_values(istate->repo)->use_nanosec
> > > +              ? (istate->timestamp.sec < sd->sd_mtime.sec ||
> > > +                 (istate->timestamp.sec == sd->sd_mtime.sec &&
> > > +                  istate->timestamp.nsec <= sd->sd_mtime.nsec))
> > > +              : istate->timestamp.sec <= sd->sd_mtime.sec));
> > >  }
> >
> > Currently this is probably fine, but the use of repo_config_values()
> > here means that the order in which we can transition/libify two
> > unrelated things are forced on us:
> >
> >  * We'd first need to make sure repo_config_values() can work on an
> >    instance of repository that is not the_repository,
> >
> >  * And until the above happens, we cannot do a --recurse-submodule
> >    option that loads the index in a submodule and operate on it in
> >    the same process (e.g., "git diff --resurse-submodules"),
> >    because immediately at this step, istate taken from a submodule
> >    would have its .repo member pointing at something that is not
> >    the_repository and we will hit a BUG().
> >
> > And after writing all of the above, I realized that I am mostly
> > repeating what Patric already said in the upstream, e.g.,
> >
> >     https://lore.kernel.org/git/an720tZnot07HYiK@pks.im/
> 
> Yep---just so I'm clear, we don't currently have such an option,
> right? I mean, there is no --recurse-submodules for git-diff(1), and I
> tweaked t4060 to run "git -c core.useNanosec=true diff
> --submodule=diff" without any issue.

I do have a patch series coming up where we start to rely more on sub-repositories when recursing. The motivation behind that series is that it allows us to get rid of registering submodule object databases with the main ODB. But I just double-checked, and your series luckily doesn't break it.

Show 16 quoted lines
> I would happily prove that at least none of our existing tests fail
> with core.useNanosec=true, but I'm not really sure how to shove
> configuration into every test invocation of git. Even if we could, I'm
> not sure we necessarily want to add another CI job for that (though
> that's a separate matter).
> 
> In particular, (among others) I have not received any concrete comments for
> 
> > Comments welcome: I haven't touched any tests; I saw a bunch of hits for
> > "git grep racy t" but wasn't sure how to fit this particular change in,
> > especially since it won't be equally valid on all systems? Advice
> > welcome.
> 
> so if there's at least a way to exercise this path on all the tests on
> my system (which should support it), that would probably be a good
> thing.

Yeah, I simply don't have a good answer here. It's messy, and I'm not a fan of the current direction of `repo_config_values()` because nobody has yet stepped up to untangle it from `the_repository`. I gave it a quick shot at one point in time, but the result was messy at best because of how we populate it via `repo_config(git_default_config)`.

In any case, if we see that your changes interact badly with some edge cases that we don't currently have on our radar then we can still refactor the series and move the value into `struct repo_settings` instead, as that structure works alright with different repositories.

Thanks!
Patrick
Previous: D. Ben KnobleNext: D. Ben Knoble
Message 47 of 74 in “Convert USE_NSEC to runtime config”
  1. 0/3 Convert USE_NSEC to runtime configD. Ben Knoble, Aug 7, 2026
  2. 1/3 meson: expose knob for xmlto relative links in manualsD. Ben Knoble, Aug 7, 2026
  3. Patrick SteinhardtAug 10, 2026
  4. 2/3 environment: align repo_config_values_init with struct declarationD. Ben Knoble, Aug 7, 2026
  5. 3/3 core: convert build-time USE_NSEC into runtime core.useNanosecD. Ben Knoble, Aug 7, 2026
  6. Junio C HamanoAug 7, 2026
  7. SZEDER GáborAug 8, 2026
  8. D. Ben KnobleAug 10, 2026
  9. D. Ben KnobleAug 10, 2026
  10. Patrick SteinhardtAug 10, 2026
  11. Ben KnobleAug 11, 2026
  12. D. Ben KnobleAug 13, 2026
  13. Patrick SteinhardtAug 14, 2026
  14. Ben KnobleAug 14, 2026
  15. Patrick SteinhardtAug 10, 2026
  16. 0/3 Convert USE_NSEC to runtime configD. Ben Knoble, Aug 14, 2026
  17. 1/3 meson: expose knob for xmlto relative links in manualsD. Ben Knoble, Aug 14, 2026
  18. 2/3 environment: align repo_config_values_init with struct declarationD. Ben Knoble, Aug 14, 2026
  19. 3/3 core: convert build-time USE_NSEC into runtime core.useNanosecD. Ben Knoble, Aug 14, 2026
  20. Junio C HamanoAug 14, 2026
  21. D. Ben KnobleAug 14, 2026
  22. 0/3 Convert USE_NSEC to runtime configD. Ben Knoble, Aug 18, 2026
  23. 1/3 meson: expose knob for xmlto relative links in manualsD. Ben Knoble, Aug 18, 2026
  24. 2/3 environment: align repo_config_values_init with struct declarationD. Ben Knoble, Aug 18, 2026
  25. 3/3 core: convert build-time USE_NSEC into runtime core.useNanosecD. Ben Knoble, Aug 18, 2026
  26. Junio C HamanoAug 18, 2026
  27. D. Ben KnobleAug 19, 2026
  28. Patrick SteinhardtAug 19, 2026
  29. D. Ben KnobleAug 19, 2026
  30. Patrick SteinhardtAug 20, 2026
  31. D. Ben KnobleAug 20, 2026
  32. Junio C HamanoAug 19, 2026
  33. D. Ben KnobleAug 19, 2026
  34. Patrick SteinhardtAug 20, 2026
  35. 0/3 Convert USE_NSEC to runtime configD. Ben Knoble, Aug 20, 2026
  36. 1/3 meson: expose knob for xmlto relative links in manualsD. Ben Knoble, Aug 20, 2026
  37. 2/3 environment: align repo_config_values_init with struct declarationD. Ben Knoble, Aug 20, 2026
  38. Junio C HamanoAug 20, 2026
  39. D. Ben KnobleAug 21, 2026
  40. 3/3 core: convert build-time USE_NSEC into runtime core.useNanosecD. Ben Knoble, Aug 20, 2026
  41. 0/3 Convert USE_NSEC to runtime configD. Ben Knoble, Aug 29, 2026
  42. 1/3 meson: expose knob for xmlto relative links in manualsD. Ben Knoble, Aug 29, 2026
  43. 2/3 environment: align repo_config_values_init with struct declarationD. Ben Knoble, Aug 29, 2026
  44. 3/3 core: convert build-time USE_NSEC into runtime core.useNanosecD. Ben Knoble, Aug 29, 2026
  45. Junio C HamanoAug 30, 2026
  46. D. Ben KnobleAug 31, 2026
  47. Patrick SteinhardtAug 31, 2026
  48. D. Ben KnobleAug 31, 2026
  49. Patrick SteinhardtAug 31, 2026
  50. Ben KnobleAug 31, 2026
  51. 0/3 Convert USE_NSEC to runtime configD. Ben Knoble, Aug 31, 2026
  52. 1/3 meson: expose knob for xmlto relative links in manualsD. Ben Knoble, Aug 31, 2026
  53. 2/3 environment: align repo_config_values_init with struct declarationD. Ben Knoble, Aug 31, 2026
  54. 3/3 core: convert build-time USE_NSEC into runtime core.useNanosecD. Ben Knoble, Aug 31, 2026
  55. Junio C HamanoSep 1, 2026
  56. D. Ben KnobleSep 1, 2026
  57. Junio C HamanoSep 1, 2026
  58. Jeff KingSep 1, 2026
  59. D. Ben KnobleSep 1, 2026
  60. Jeff KingSep 2, 2026
  61. Ben KnobleSep 2, 2026
  62. Junio C HamanoSep 2, 2026
  63. Ben KnobleSep 3, 2026
  64. Junio C HamanoSep 3, 2026
  65. Ben KnobleSep 3, 2026
  66. D. Ben KnobleAug 31, 2026
  67. 0/3 Convert USE_NSEC to runtime configD. Ben Knoble, Sep 11, 2026
  68. 1/3 meson: expose knob for xmlto relative links in manualsD. Ben Knoble, Sep 11, 2026
  69. 2/3 environment: align repo_config_values_init with struct declarationD. Ben Knoble, Sep 11, 2026
  70. 3/3 core: convert build-time USE_NSEC into runtime core.useNanosecD. Ben Knoble, Sep 11, 2026
  71. Junio C HamanoSep 11, 2026
  72. Ben KnobleSep 11, 2026
  73. Patrick SteinhardtAug 31, 2026
  74. Ben KnobleSep 1, 2026

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.