git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cristian Morales Vega <christian.morales.vega@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Cristian Morales Vega <christian.morales.vega@gmail.com>,
	Git Users <git@vger.kernel.org>
Subject: Re: git checkout behaviour when only ctime of file changes
Date: Tue, 20 Apr 2021 07:10:01 +0100	[thread overview]
Message-ID: <CAOWQn3Rr7qsTTjY1CYj1SAXk6_fhEc8mFn1o4Dep5N0c9yeK1A@mail.gmail.com> (raw)
In-Reply-To: <YH42xGwjTX4Axcpp@camp.crustytoothpaste.net>

On Tue, 20 Apr 2021 at 03:05, brian m. carlson
<sandals@crustytoothpaste.net> wrote:
>
> On 2021-04-19 at 09:11:12, Cristian Morales Vega wrote:
> > 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.
> > _Maybe_ it could make sense for "git checkout" to always behave as if
> > "git update-index --refresh" had been run before? No idea really.
>
> I believe the situation you're seeing is that git checkout usually
> doesn't rewrite files in the working tree that are already up to date.
> This makes checkout much faster in large working trees.
>
> By default, Git does include the ctime in its computation of whether a
> file is up to date.  If the ctime changes, then the file is considered
> to be stale.  git checkout, without an intervening command, will
> overwrite it, since it's dirty and just overwriting it is cheaper than
> determining whether it is in fact up to date.

Yes, this is basically it. The "just overwriting it is cheaper than
determining whether it is in fact up to date" is the main thing. I was
thinking that maybe, if ctime has changed but mtime hasn't, it could
be faster to not overwrite the files since I _think_ it means the file
contents don't need to be checked, only the basic file permissions (I
don't think git stores any extended attributes, does it?). But I could
be completely wrong here. Otherwise "core.trustctime" seems like the
perfect option for the problem.

      reply	other threads:[~2021-04-20  6:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19  9:11 git checkout behaviour when only ctime of file changes Cristian Morales Vega
2021-04-19 11:10 ` Bagas Sanjaya
2021-04-19 11:23   ` Cristian Morales Vega
2021-04-19 20:47 ` Junio C Hamano
2021-04-20  2:04 ` brian m. carlson
2021-04-20  6:10   ` Cristian Morales Vega [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOWQn3Rr7qsTTjY1CYj1SAXk6_fhEc8mFn1o4Dep5N0c9yeK1A@mail.gmail.com \
    --to=christian.morales.vega@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).