Skip to content

Commit e22893c

Browse files
committed
fix: do not trust ctime by default.
On MacOS it seems to be off by two seconds right from the source, which seems to be an issue `stat` isn't having.
1 parent fd034e0 commit e22893c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

gix/src/config/cache/access.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@ impl Cache {
158158
pub(crate) fn stat_options(&self) -> Result<gix_index::entry::stat::Options, config::stat_options::Error> {
159159
use crate::config::tree::gitoxide;
160160
Ok(gix_index::entry::stat::Options {
161-
trust_ctime: boolean(self, "core.trustCTime", &Core::TRUST_C_TIME, true)?,
161+
trust_ctime: boolean(
162+
self,
163+
"core.trustCTime",
164+
&Core::TRUST_C_TIME,
165+
// For now, on MacOS it's known to not be trust-worthy at least with the Rust STDlib, being 2s off
166+
!cfg!(target_os = "macos"),
167+
)?,
162168
use_nsec: boolean(self, "gitoxide.core.useNsec", &gitoxide::Core::USE_NSEC, false)?,
163169
use_stdev: boolean(self, "gitoxide.core.useStdev", &gitoxide::Core::USE_STDEV, false)?,
164170
check_stat: self

gix/src/config/tree/sections/core.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ impl Core {
4545
/// The `core.symlinks` key.
4646
pub const SYMLINKS: keys::Boolean = keys::Boolean::new_boolean("symlinks", &config::Tree::CORE);
4747
/// The `core.trustCTime` key.
48-
pub const TRUST_C_TIME: keys::Boolean = keys::Boolean::new_boolean("trustCTime", &config::Tree::CORE);
48+
pub const TRUST_C_TIME: keys::Boolean = keys::Boolean::new_boolean("trustCTime", &config::Tree::CORE)
49+
.with_deviation("Currently the default is false, instead of true, as it seems to be 2s off in tests");
4950
/// The `core.worktree` key.
5051
pub const WORKTREE: keys::Any = keys::Any::new("worktree", &config::Tree::CORE)
5152
.with_environment_override("GIT_WORK_TREE")

0 commit comments

Comments
 (0)