Patch Set 2: I would prefer that you didn't submit this

I've added some test cases.  I'd also like some feedback in general on this approach.

To reiterate, the reason we're making this change is to add support for automatic subtree splitting/rewriting to Gerrit as an alternative to submodules.  For some background on this, visit our original change to Gerrit here: https://review.source.android.com/#change,20163.

We've been running a modified version of Gerrit here at Garmin that includes this change.  We're hoping that we can get our changes mainlined so we don't have to run a custom version.