Documentation
¶
Overview ¶
Package githash provides types for Git object identifiers.
Index ¶
Constants ¶
const SHA1Size = 20
SHA1Size is the number of bytes in a SHA-1 hash.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ref ¶ added in v0.9.0
type Ref string
A Ref is a Git reference to a commit.
const ( // Head names the commit on which the changes in the working tree // are based. Head Ref = "HEAD" // FetchHead records the branch which was fetched from a remote // repository with the last git fetch invocation. FetchHead Ref = "FETCH_HEAD" )
Top-level refs.
func (Ref) Branch ¶ added in v0.9.0
Branch returns the string after "refs/heads/" or an empty string if the ref does not start with "refs/heads/".
func (Ref) IsValid ¶ added in v0.9.0
IsValid reports whether r is a valid reference name. See https://git-scm.com/docs/git-check-ref-format for rules.
type SHA1 ¶
A SHA1 is the SHA-1 hash of a Git object.
func ParseSHA1 ¶
ParseSHA1 parses a hex-encoded SHA-1 hash. It is the same as calling UnmarshalText on a new SHA1.
func (SHA1) Format ¶
Format implements the fmt.Formatter interface. Specifically, it ensures that %x does not double-hex-encode the data.
func (SHA1) MarshalBinary ¶
MarshalBinary returns the hash as a byte slice.
func (SHA1) MarshalText ¶
MarshalText returns the hex-encoded hash.
func (*SHA1) UnmarshalBinary ¶
UnmarshalBinary copies the bytes from b into h. It returns an error if len(b) != len(*h).
func (*SHA1) UnmarshalText ¶
UnmarshalText decodes a hex-encoded hash into h.