Resolve trees from commit objects without asking git

I'm probably going to revert this one later, as it's not in any way
performance-critical (it will only run once in a bup-restore).  I'm
mostly committing it because I happened to have already written it.

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>