Fix examples to make the important stuff more obvious

This extracts some common utility functions and reorganizes the code in the examples to move the important stuff closer to the top of the files and leave the less important stuff (like parsing command line arguments) down towards the bottom. Sometimes the command line parsing is important because it shows how to translate command line arguments that you may already understand into libgit2 equivalents, but usually the actual use of the functions and objects is the hard part, I suspect.

* [x] Create common utility functions (`examples/common.h` and `examples/common.c`)
* [ ] Update `examples/add.c`
* [ ] Update `examples/cat-file.c`
* [ ] Update `examples/common.c`
* [x] Update `examples/diff.c`
* [ ] Update `examples/general.c`
* [ ] Update `examples/init.c`
* [x] Update `examples/log.c`
* [ ] Update `examples/rev-list.c`
* [ ] Update `examples/rev-parse.c`
* [ ] Update `examples/showindex.c`
* [x] Update `examples/status.c`