Cleanup RevWalk.parseCommit, parseTree to not throw ClassCastException