Subject: Re: how to produce an index with smudged entries

From: Robin Rosenberg <[email-masked]>
Date: Sun, 02 Oct 2011 15:10:24 +0200

Christian Halstrick skrev 2011-09-30 17.33:
> I am trying to find out how native git handles the racy git problem. I
> read https://raw.github.com/git/git/master/Documentation/technical/racy-git.txt.
> But I cannot reproduce the behaviour described in this text.

I guess that code is only likely to work if USE_NSEC is not set or the
file system has only whole second resolution. It might be very hard to 
reproduce the situation since the likehood that a file AND the index has 
the same timestamp at the subsecond level is very small. Nasty thing to 
test :)

Is your file system one that does not have subsecond timestamp 
resolution? The nanosecond part of the timestamp(s) should be 0 (byte 
24-27 for mtime for the first index entry).

Touch can set the timestamp to an explicit value, so you can use that 
instead of waiting for luck. Touch cannot set ctime, but you can make 
git ignore ctime by setting core.trustctime to false.

For testing the issue with nanosecond resolution you have to roll your 
own touch in C, perl or even Java.

-- robin