Test and fix Git diff binary detection compatibility

I updated our NUL-byte check that we use for binary detection in diffs to use the first 8000 bytes of a file. Then I wrote a new test that verifies binary detection for a variety of cases in diff, making sure that the results match what `git diff` seems to do at the command line.