This changes tree_sha512sum() to requests the objects for hashing from git instead of from the working tree.
The change should make the process more deterministic (it hashes what will be pushed) and hopefully avoids the frequent miscomputed SHA512's that happen now.
As an added bonus this can now compute treehashes for non-HEAD commits, although this functionality is not used.