Re: [PATCH v5 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 30, 2026, 21:15 UTC
- Message-ID
- <xmqq8q5n1fa2.fsf@gitster.g>
- In-Reply-To
- <01cd487cd23f23b1d18359b86fbcf18e25039e6d.1788010335.git.ben.knoble@gmail.com>
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
Show 7 quoted lines
> + /* 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/
Other than that, this looks good to me.