Trying to determine how quickly a user would be warned of corruption in the object database with git-1.7.4.1, I pulled a one-bit switcheroo:
$ git init repo
Initia
Here's how I would go about finding this out, although I'm not going to go through each source file to work out the conditions under which the check is performed. :)
Clone git's source code:
git clone git://git.kernel.org/pub/scm/git/git.git
Check out the version you care about:
cd git
git checkout v1.7.1
Look for that error message:
git grep 'sha1 mismatch'
That leads you to object.c and the parse_object function. Now look for that function:
git grep parse_object
... and go through the 38 files checking the conditions under which that function will be called.