All outstanding patches from upstream, except the whitespace cleanup one

This PR has the outstanding patches from this year from http://repo.or.cz/w/git-dm.git.

It specifically excludes the whitespace cleanup one, which did not apply directly.