]> git.ipfire.org Git - thirdparty/git.git/commit
write_index(): update index_state->timestamp after flushing to disk
authorKjetil Barvik <barvik@broadpark.no>
Mon, 23 Feb 2009 18:02:57 +0000 (19:02 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Feb 2009 02:04:20 +0000 (18:04 -0800)
commite1afca4fd3e7cb4000874e991277f10119de4ad2
treec71e47c710fafa7042ebebe3d70a22ae1c125d02
parent1dcafcc0e639ecc69b54421bda5f2270ed2601eb
write_index(): update index_state->timestamp after flushing to disk

Since this timestamp is used to check for racy-clean files, it is
important to keep it uptodate.

For the 'git checkout' command without the '-q' option, this make a
huge difference.  Before, each and every file which was updated, was
racy-clean after the call to unpack_trees() and write_index() but
before the GIT process ended.

And because of the call to show_local_changes() in builtin-checkout.c,
we ended up reading those files back into memory, doing a SHA1 to
check if the files was really different from the index.  And, of
course, no file was different.

With this fix, 'git checkout' without the '-q' option should now be
almost as fast as with the '-q' option, but not quite, as we still do
some few lstat(2) calls more without the '-q' option.

Below is some average numbers for 10 checkout's to v2.6.27 and 10 to
v2.6.25 of the Linux kernel, to show the difference:

before (git version 1.6.2.rc1.256.g58a87):
 7.860 user  2.427 sys  19.465 real  52.8% CPU  faults: 0 major 95331 minor
after:
 6.184 user  2.160 sys  17.619 real  47.4% CPU  faults: 0 major 38994 minor

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
read-cache.c