Subject: Re: git checkout behaviour when only ctime of file changes

From: Junio C Hamano <[email-masked]>
Date: Mon, 19 Apr 2021 13:47:26 -0700

Cristian Morales Vega <[email-masked]> writes:

> I thought you may want to take a look at
> https://issues.jenkins.io/browse/JENKINS-65395.
>
> Basically after something updates the ctime of a file, a
> "git checkout" can behave differently depending on whether a
> "git update-index --refresh" has been run before or not.

Changes to ctime, not just to mtime, participate in "the path may
have been changed so need to go back to the contents to see if it
truly has" logic, and "update-index --refresh" is a mechanism to
clear that "the path may have been changed" bit.  

So if your "behave differently ... with or without refresh" happens
equally if you replace 'ctime' in your statement with 'mtime', then
everything is working as designed.  But it was unclear from your
description.

Assuming that the difference with and without refresh after mtime
change is the same as the difference with and without refresh after
ctime change, the "core.trustctime" configuration variable is for
those whose files have untrustworthy ctime (due to background
scanners and other funnies).