Refactor: split checking of formatting & 'in-place' formatting

This simplifies the python script quite a bit by doing all the in-place
formatting done by the 'format' CMake target in one path, and the
checking of correct formatting in another.

formatFile() is now only used to change (format) a file via the 'format'
CMake target.

requiresFormat() is now only used by the correctness checking logic, and
does the clang-format and the diff in one function.
Only require correct formatting on staged chunks.

This uses "git show :file-name" to show the file contents as it is
staged to check formatting. Previously it would take the file name and
check the file as it exists on disk, which doesn't always reflect a
developer's intentions.

This commit means a developer can now commit correctly-formatted chunks
of a file while leaving other chunks of the same file unformatted.
Merge remote-tracking branch 'upstream/master'
Merge pull request #4 from frasercrmck/master

Refactor + only check formatting on staged chunks