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

"D. Ben Knoble" <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CALnO6CBqJT6uHTXvgffB9rW458THr5LjzL=NZSt81PPfBATPyA@mail.gmail.com>
On Sat, Aug 8, 2026 at 12:31 PM SZEDER Gábor <[email protected]> wrote:
>
> On Fri, Aug 07, 2026 at 02:17:39PM -0700, Junio C Hamano wrote:
> > "D. Ben Knoble" <[email protected]> writes:
> >
> > > Racy Git problems persist today, manifesting themselves in the
> > > performance of commands like "git diff" in new worktrees [1]. We have
> > > long had a build knob "USE_NSEC" to tell Git to use in-core nanosecond
> > > precision when available, which mitigates most if not all racy issues,
> > > but most builds we know about it don't use it. In part, that's because
> > > someone distributing Git can't safely enable it at compile-time if they
> > > don't know exactly what platforms their distribution will be used on.
> > >
> > > [1]: https://lore.kernel.org/git/CALnO6CADMJSixqYvL1Yo8qKX5rWhKQ+2OoSEuPUh-yoeK9TseQ@mail.gmail.com
> > >
> > > These days, most platforms are likely to be safe for the USE_NSEC code.
> > > Regardless, we want to give users the ability to benefit from it. This
> > > requires exposing the compile-time gated code as a runtime option.
> > >
> > > In addition, update the Racy Git documentation and other mentions of
> > > USE_NSEC in the code.
> > >
> > > Best-viewed-with: --ignore-space-change
> >
> > Don't do this.  It probably is helpful to have something like that
> > below the three-dash lines, though.
>
> Including this hint in the commit message could be useful for anyone
> who stumbles upon this commit in a couple of months or years time.
> Whether it should be a trailer or not is another question.

Yep, the trailer is a force-of-habit for me. I'll move it into the
commit message body in the next version.

I do find it helpful when the author of a patch---who presumably knows
the changes best---provides some guidance on making sense of the diff.
In this case, some code is re-indented as '#ifdef's change to runtime
'if's, so ignoring whitespace changes makes it easier to see there was
no change there.

-- 
D. Ben Knoble
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.