git

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAll

func AddAll()

AddAll runs `git add -A` command. Exits if it fails.

func AddFile added in v0.3.0

func AddFile(path string)

func AreChangesAddedToBeCommited

func AreChangesAddedToBeCommited() bool

AreChangesAddedToBeCommited checks if `git status` output contains `Changes to be committed` string, meaning there are currently changes staged for commit.

func CreateCommit

func CreateCommit(m string)

CreateCommit runs `git commit -m` command. Exits if it fails.

func IsMergeCommit

func IsMergeCommit(m string) bool

IsMergeCommit checks if a commit is a merge commit FIXME: Dirty fix to identify default merge commits

func LintCommitMessage

func LintCommitMessage(m string) bool

LintCommitMessage check if a message respect the conventional commit convention TODO: apply .env file

func Log

func Log() string

Log runs `git log --abrev-commit` command. Exits if it fails.

func LogChangelog

func LogChangelog(firstCommit string, secondCommit string) string

LogChangelog runs `git log --oneline --first-parent [rev1]...[rev2]`. It logs the commit history between 2 revisions. If the first one is empty, defaults to `HEAD`

func LogCommitMessage

func LogCommitMessage(rev1 string, rev2 string) []string

LogCommitMessage returns commit message list between 2 revisions

func LogShortHash

func LogShortHash(rev1 string, rev2 string) []string

LogShortHash returns commit short hashes list between 2 revisions

func ShowTopLevel

func ShowTopLevel() string

ShowTopLevel runs `git rev-parse --show-toplevel` command. Exits if it fails.

func Status

func Status() string

Status runs `git status` command. Exits if it fails.

func TagCommit added in v0.3.0

func TagCommit(version string)

Types

type Commit

type Commit struct {
	Hash             string
	Type             string
	Scope            string
	IsBreakingChange bool
	IsMergeCommit    bool
	Msg              string
}

Commit struct respresents a git commit object

func ParseLogOutput

func ParseLogOutput(log string) []Commit

ParseLogOutput generate a list of git.Commit from a git log output

func (*Commit) FillFromStrMsg

func (c *Commit) FillFromStrMsg(m string)

FillFromStrMsg fill commit information from a string inside a git.Commit object

Jump to

Keyboard shortcuts

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