you can reproduce this using git:
rm .git/index git diff --binary -R HEAD | git apply --whitespace=fix --cached