Raise sha error if necessary, always return refs, fix docs.