Upstream

Fixes multiple bugs in dulwich.

Now we can clone an empty repo, fetch with no changes, etc without crashing.