From: Linus Torvalds Date: Wed, 11 Jun 2008 01:36:18 GMT Subject: Re: git bugs Message-ID: In-Reply-To: <832adb090806101702l79aba80cvba1eaab029e9ecd5@mail.gmail.com> On Tue, 10 Jun 2008, Ben Lynn wrote: > > I call time(NULL) for each file out of laziness. I could cache the > value somewhere the first time, but that means I'd have to pass around > an extra argument to a whole bunch of functions, because of the way > I've written my code. But I don't think it's much of a drawback, > because I stat() each file anyway. No, that would be horrible. There is no guarantee that time() has anything to do with the stat timestamps anyway. The right way to do things would be to just do a stat() on the index file as it is created, and then save the mtime of that stat into the file. That way, you have the mtime of the index file not for the *last* write, but for the *first* one. Linus