git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Alexander Gladysh <agladysh@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: gitk pays too much attention to file timestamps
Date: Tue, 6 Apr 2010 18:36:01 -0500	[thread overview]
Message-ID: <20100406233601.GA27533@progeny.tock> (raw)
In-Reply-To: <l2hc6c947f61004061557x8085600fif5e973077d9eb4f3@mail.gmail.com>

Hi!

Alexander Gladysh wrote:

> When I "touch" a file, gitk lists it in "local uncommitted changes,
> not checked in to index" (without a difference, just a name). I
> believe that it should not.

First, an explanation:

In general, git keeps some stat(2) information to tell whether an
entry in the index is "dirty".  This way, low-level commands can
compare that to the metadata in the file to avoid a costly
comparison of actual objects to the content of files on disk.

Before starting work, the high-level commands like ‘git commit’ will
generally update this stat(2) information in one pass before doing
anything else.  This turns any "dirty" entries without actually
different content in the index into clean entries, so the user doesn’t
have to worry about anything except content for these commands.  You
can request this update at any time yourself with the following
command:

  git update-index --refresh -q

Unlike ‘git checkout HEAD -- .’ this does not touch the files in
your work tree, and unlike ‘git reset HEAD’, it does not affect the
content registered in the index for your files.

Okay, on to your topic:

gitk is something of a passive observer of the index, which is
actually something I like about it.  This keeps it relatively fast
and can be useful when trying to understand other commands.

I am not sure how other people use gitk, though.  Maybe this would
be worth changing.  For a reference point, another command in a
very similar situation is ‘git diff’: people who want the speedup
from avoiding refreshing the index with that command use

	[diff]
		autoRefreshIndex = false

in their configuration file, so the rest of us don’t have to suffer
from the confusing behavior.

As some kind of evil compromise, it might be worth teaching gitk
to check the same configuration and run update-index --refresh in
getcommits{} if and only if it is unset or set to true.

Thoughts?
Jonathan

  parent reply	other threads:[~2010-04-06 23:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06 22:57 gitk pays too much attention to file timestamps Alexander Gladysh
2010-04-06 23:15 ` Markus Heidelberg
2010-04-06 23:36 ` Jonathan Nieder [this message]
2010-04-06 23:47   ` Alexander Gladysh
2010-04-07  0:43     ` [PATCH/RFC] gitk: refresh index before checking for local changes Jonathan Nieder
2010-04-07  1:07       ` Alexander Gladysh
2010-04-07  1:16       ` Jonathan Nieder
2010-04-07  2:21       ` A Large Angry SCM
2010-04-07  2:57         ` Jonathan Nieder
2010-04-07  5:47         ` Junio C Hamano
2010-04-07 11:21           ` A Large Angry SCM
2010-04-07 16:48           ` Avery Pennarun
2010-04-07 14:36         ` Jon Seymour
2010-04-06 23:58   ` gitk pays too much attention to file timestamps Avery Pennarun
2010-04-07  1:01     ` Jonathan Nieder

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=20100406233601.GA27533@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=agladysh@gmail.com \
    --cc=git@vger.kernel.org \
    /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).