]> git.ipfire.org Git - thirdparty/git.git/commit - Makefile
Windows: Skip fstat/lstat optimization in write_entry()
authorJohannes Sixt <j6t@kdbg.org>
Mon, 20 Apr 2009 08:17:00 +0000 (10:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Apr 2009 19:14:02 +0000 (12:14 -0700)
commit34779c535c4e121414197ab08b4b502a22a75433
treed856d59cbc54cbb7a79c5d22abc0d31bf93acd0c
parent6ac6f87818edfd33fea8ce3c95b47fe00a4e4b91
Windows: Skip fstat/lstat optimization in write_entry()

Commit e4c72923 (write_entry(): use fstat() instead of lstat() when file
is open, 2009-02-09) introduced an optimization of write_entry().
Unfortunately, we cannot take advantage of this optimization on Windows
because there is no guarantee that the time stamps are updated before the
file is closed:

  "The only guarantee about a file timestamp is that the file time is
   correctly reflected when the handle that makes the change is closed."

(http://msdn.microsoft.com/en-us/library/ms724290(VS.85).aspx)

The failure of this optimization on Windows can be observed most easily by
running a 'git checkout' that has to update several large files. In this
case, 'git checkout' will report modified files, but infact only the
timestamps were incorrectly recorded in the index, as can be verified by a
subsequent 'git diff', which shows no change.

Dmitry Potapov reports the same fix needs on Cygwin; this commit contains
his updates for that.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
entry.c
git-compat-util.h