Detect symlinks and submodules

This also rewrites the the parser for FileDiffStats to be actually sane.  I'll merge this once I am more certain of its correctness.