Diff code reorg plus function context in diff headers

This is a significant reorganization of the diff code. I took the old `src/diff_output.c` that had grown quite large and split it into:

* `src/diff_file.c` loads individual files - a patch contains two of these
* `src/diff_patch.c` generates patches and can be iterated
* `src/diff_xdiff.c` wraps the xdiff dependencies and provides some isolation in the rest of the code
* `src/diff_driver.c` is a new file that contains the framework for supporting diff drivers, function, context, etc.

Each of these files is much smaller with a narrower focus. I tried to explain the breakdown of everything in the new `docs/diff-internals.md`.

As part of the new diff drivers work, I added a diff driver cache to the `git_repository` and removed several unnecessary includes from `src/repository.h`. After I removed those includes, I had to compensate in a bunch of places around the codebase, but I think it is a good thing because the includes were really overbroad IMO.

I looked at things in valgrind and there are a bunch of leaks, but most seem related to the new refs stuff and not to this diff code. There is a commit that fixes a few memory leaks that I stuck in just to try to get the valgrind output more readable.

- [x] reorganize diff into more discrete parts
- [x] implement diff driver framework
- [x] implement default diff driver that finds last non-blank line (as per core git)
- [ ] implement regex based diff drivers for various languages
- [x] better isolation for libxdiff code bits