git

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldNames = map[string]string{
	"%h":  "abbreviated_commit",
	"%p":  "abbreviated_parent",
	"%t":  "abbreviated_tree",
	"%aD": "author_date",
	"%aE": "author_email",
	"%aN": "author_name",
	"%b":  "body",
	"%H":  "commit",
	"%N":  "commit_notes",
	"%cD": "committer_date",
	"%cE": "committer_email",
	"%cN": "committer_name",
	"%e":  "encoding",
	"%P":  "parent",
	"%D":  "refs",
	"%f":  "sanitized_subject_line",
	"%GS": "signer",
	"%GK": "signer_key",
	"%s":  "subject",
	"%G?": "verification_flag",
}

FieldNames are for the formating and rendering of the CommitEntry structs. Keys here are from git log pretty format "format:..."

Functions

func Check

func Check(commit string) ([]byte, error)

Check warns if changes introduce whitespace errors. Returns non-zero if any issues are found.

func FetchHeadCommit

func FetchHeadCommit() (string, error)

FetchHeadCommit returns the hash of FETCH_HEAD

func HeadCommit

func HeadCommit() (string, error)

HeadCommit returns the hash of HEAD

func Show

func Show(commit string) ([]byte, error)

Show returns the diff of a commit.

NOTE: This could be expensive for very large commits.

Types

type CommitEntry

type CommitEntry map[string]string

CommitEntry represents a single commit's information from `git`. See also FieldNames

func Commits

func Commits(commitrange string) ([]CommitEntry, error)

Commits returns a set of commits. If commitrange is a git still range 12345...54321, then it will be isolated set of commits. If commitrange is a single commit, all ancestor commits up through the hash provided. If commitrange is an empty commit range, then nil is returned.

func LogCommit

func LogCommit(commit string) (*CommitEntry, error)

LogCommit assembles the full information on a commit from its commit hash

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL