git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ghazel@gmail.com
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git reset and ctime
Date: Fri, 3 Dec 2010 17:39:08 -0800	[thread overview]
Message-ID: <AANLkTi=MSf+0rkBmvuJQBaSs1-G_gFahnLvt44fnwAwf@mail.gmail.com> (raw)
In-Reply-To: <20101204005131.GB15906@burratino>

On Fri, Dec 3, 2010 at 4:51 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> ghazel@gmail.com wrote:
>
>> I've encountered a strange issue where "git reset --hard" insists on
>> "Checking out files ..." when all that is changed is the ctime
>
> There is a performance trade-off.  Refreshing the index requires
> reading+hashing the existing file if the stat information changed;
> this could be faster or slower than blindly overwriting depending on
> the situation.
>
> That said, I have no strong objection to an implicit refresh in "git
> reset" (performance-sensitive scripts should be using read-tree
> directly anyway).  Have you tried making that change to
> builtin/reset.c?  How does it perform in practice?

I did not make the modifications to reset.c, I just ran the refresh
before reset:

So originally:

$ time git reset --hard <rev>
Checking out files: 100% (2772/2772), done.

real    0m5.328s
user    0m2.539s
sys     0m2.542s

as opposed to:

$ time git update-index --refresh

real    0m1.236s
user    0m1.024s
sys     0m0.201s

$ time git reset --hard <rev>

real    0m0.055s
user    0m0.011s
sys     0m0.041s

>>              My deploy process (capistrano) maintains a cached copy of
>> a git repo, which it fetches, resets, and then hardlinks files from
>> when a deploy occurs ( https://github.com/37signals/fast_remote_cache
>> ). The hardlinking step is meant to save the time of copying the file.
>> but hardlinking changes the ctime of the source files.
>
> Interesting.  Setting "[core] trustctime = false" in the repository
> configuration could be a good solution (no performance downside I can
> think of).

This is a very useful suggestion. I do not see a case where ctime
would be valuable to me. Is it really valuable to other people? What
is the trade-off?

-Greg

  reply	other threads:[~2010-12-04  1:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-03 21:36 git reset and ctime ghazel
2010-12-04  0:51 ` Jonathan Nieder
2010-12-04  1:39   ` ghazel [this message]
2010-12-04  1:47     ` Jonathan Nieder
2010-12-04  2:28   ` Junio C Hamano
2010-12-06 17:37   ` Drew Northup
2010-12-06 17:51     ` Jonathan Nieder
2010-12-07 15:14       ` Drew Northup

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='AANLkTi=MSf+0rkBmvuJQBaSs1-G_gFahnLvt44fnwAwf@mail.gmail.com' \
    --to=ghazel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /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).