Improve Repository#log performance

This speeds up the `Repository#log` method when a path is passed without the `:follow` option.  On my laptop, this results in much better performance when called for the GitLab CE repo with "public" as the path and without limiting the number of returned commits:

#### Old

           user     system      total        real
      11.500000   0.620000  12.120000 ( 12.170366)

    Found 69 commits

#### New

           user     system      total        real
       0.770000   0.190000   0.960000 (  0.963141)

    Found 69 commits

#### Remaining issues

* This speedup is due to using commit trees to determine which commits touch a path, rather than generating a `Rugged::Diff` for each commit and iterating over its deltas.  However, the `:follow` option relies on `Rugged::Diff#find_similar` to detect file renames, so tree comparison is only used in the absence of that option.

* This change doesn't alter the output of the `#log` method, but it turns out that `#log` doesn't match `git log` when a path is specified.  This method will need some more work to implement the history simplification that native git uses by default.

Feel free to merge this branch as-is, but I'll plan on making additional changes to this method to address these issues.
Explicit non-nil checks are usually redundant.