I strongly support paranoia. That written, I hope your contributors would notice the "your branch has diverged" warnings or the fact their merge commits suddenly pull in hundreds of new SHA1 hashes.
Something like the following should get you most of the way there. I unfortunately cannot test it right now, but git-receive-pack
and githooks
's man pages were helpful, as was this example:
#!/bin/sh
while read oldrev newrev refname
do
git rev-list ^$oldrev $newrev | grep "<problem-hash>"
if test $? = 0; then
echo "Problematic hash found. Please contact the maintainer."
exit 1
fi
done
Searching for the file itself using pre-receive:
#!/bin/sh
while read oldrev newrev refname
do
git diff $oldrev $newrev --name-only | grep "<full_file_path>"
if test $? = 0; then
echo "Problematic hash found. Please contact the maintainer."
exit 1
fi
done