Handle merging an existing directory with an incoming directory.

Add tests for this new functionality.  Also test for repository
breakage (git fsck), and clean up test framework a bit.

Testing Done:
I ran the tests. I also redid the real-world import; git fsck on the newly-created branch reports no problems.

Reviewed at https://rbcommons.com/s/twitter/r/951/