From: Johannes Sixt Date: Thu, 08 Nov 2007 15:45:59 GMT Subject: Re: [PATCH 4/3] t3700: avoid racy git situation Message-ID: <47332F37.5090402@viscovery.net> In-Reply-To: Johannes Schindelin schrieb: > The problem is that the index has the same timestamp as the file "foo". > > Therefore, git cannot tell if "foo" is up-to-date in the index, since it > could have been modified (and indeed is) just a fraction of a second later > than the index was last updated. The test goes like this: >foo && git add foo && git commit -a -m "commit all" && test -z "`git diff-index HEAD -- foo`" && git read-tree HEAD && case "`git diff-index HEAD -- foo`" in :100644" "*"M foo") echo ok;; *) echo fail; (exit 1);; esac && git add --refresh -- foo && test -z "`git diff-index HEAD -- foo`" I'm pretty sure that this test completed within one second even before git-commit was a builtin. (I assume that timestamps don't have sub-second resolution.) Why then didn't this racy-git problem occur with the scripted git-commit? -- Hannes