Example #1
0
// NewIDFromString creates a new sha1 from a ID string of length 40.
func NewIDFromString(s string) (sha1, error) {
	oid, err := rawgit.ParseOID(s)
	if err != nil {
		return sha1{}, err
	}

	return sha1(*oid), nil
}
Example #2
0
func (repo *Repository) GetCommit(commitID string) (*Commit, error) {
	oid, err := rawgit.ParseOID(commitID)
	if err != nil {
		return nil, err
	}

	return repo.openCommit(oid)
}
Example #3
0
// MustIDFromString always creates a new sha from a ID with no validation of input.
func MustIDFromString(s string) sha1 {
	oid, _ := rawgit.ParseOID(s)
	return sha1(*oid)
}