Submodule diff tests and fixes

This PR is a superset of #1443 that adds tests and contains further fixes.

There was never any significant test coverage for diffs of submodules and seeing the fix in #1443, I decided to add some. That immediately surfaced a couple of other bugs regarding submodule diffs that needed to be fixed.

In total, this PR contains:

1. New tests for diffs of submodules in new file `tests-clar/diff/submodules.c`
2. Fix to consider submodule data "diffable" even if the SHA is unchanged when the submodule's working directory is dirty (i.e. ehe original fix from #1443)
3. Fix to dirty check of submodules in working directory so being dirty in the parent index is not interpreted as having a dirty working directory copy
4. Fix to patch printing / conversion to string to not include patch headers for files/submodules with no meaningful content
5. Fixes for warnings when compiling with clang