Add example program to emulate 'git log' and create pathspec matching API

I started this a little while ago as an attempt to write an example program that would mimic `git log` behavior. I ended up with that (albeit only supporting a small fraction of the options), plus new public APIs for "compiling" a pathspec and matching against the working directory, the index, or an arbitrary tree. I also added a couple of small adjustments that probably won't make much difference - a way to get the raw text of a commit header (which changed the commit parsing internals slightly since I now keep the commit header text around) and a `GIT_INDEX_STAGE_ANY` constant that can be used during index lookups if you just want to find out if a given file is mentioned anywhere in the index regardless of the stage.

The log example is far from complete. In particular, I didn't really do any formatting, including no support currently for `--oneline` or anything like that. Also, there is no color output or pagination, so it's kind of a pain to use. However, once the basic `log` example is in place, it becomes more of a side project or newbie project to add support for various command line options.

The log example does support several of the simple options (`--max-count` and `--skip`, `--min-parents` and `--max-parents`) and it supports two of the more complicated options: pathname matching and patch printing (`-p`). The pathname matching was particularly interesting - it is the reason that I created the public pathspec API (although in the end, it generally works off of diff, not off of the pathspec API) and because it took me a while to get the rules right for merge commits. The diff display was pretty easy given that we have a working example of diff.

Comments and criticism welcome! There are probably some parts of the example that are a little odd, so I'd love feedback.