Re: [PATCH 4/3] t3700: avoid racy git situation
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Nov 8, 2007, 15:45 UTC
- Message-ID
- <47332F37.5090402@viscovery.net>
- In-Reply-To
- <Pine.LNX.4.64.0711081511440.4362@racer.site>
Johannes Schindelin schrieb:
Show 5 quoted lines
> 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