git

package
v0.0.0-...-b6f9656 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RebaseArgsEnvVar = "MAIAO_REBASE_ARGUMENTS"
)

Variables

This section is empty.

Functions

func FindGitDir

func FindGitDir(path string) (string, error)

func HookPath

func HookPath(gitDir string, hook Hook) string

func MergeBase

func MergeBase(ctx context.Context, repo Repository, base, head plumbing.Revision) (plumbing.Hash, error)

func RebaseCommits

func RebaseCommits(ctx context.Context, repo Repository, base, onto plumbing.Hash, todo string) error

Types

type Hook

type Hook string
const (
	ApplyPatchMsgHook    Hook = "applypatch-msg"
	PostApplyPatchHook   Hook = "post-applypatch"
	PostCheckoutHook     Hook = "post-checkout"
	PostCommitHook       Hook = "post-commit"
	PostMergeHook        Hook = "post-merge"
	PostRewriteHook      Hook = "post-rewrite"
	PrepareCommitMsgHook Hook = "prepare-commit-msg"
	PreApplyPatchHook    Hook = "pre-applypatch"
	PreAutoGCHook        Hook = "pre-auto-gc"
	PrePushHook          Hook = "pre-push"
	PreRebaseHook        Hook = "pre-rebase"
)
const (
	CommitMsgHook Hook = "commit-msg"
)

type Message

type Message struct {
	Title   string
	Body    string
	Headers map[string]string
}

Message defines the model of a commit message

func Parse

func Parse(message string) *Message

Parse parses a commit message string into a structured object

func (*Message) GetChangeID

func (m *Message) GetChangeID() (changeID string, ok bool)

GetChangeID returns the changeID in the commit message and if it has been found

func (*Message) GetTitle

func (m *Message) GetTitle() string

GetTitle returns the commit title after stripping all fixup prefixes

func (*Message) IsFixup

func (m *Message) IsFixup() bool

IsFixup returns if a commit is a fixup of another commit

func (*Message) String

func (m *Message) String() string

type Repository

type Repository interface {
	Head() (*plumbing.Reference, error)
	Remote(name string) (*git.Remote, error)
	Push(o *git.PushOptions) error
	Branches() (storer.ReferenceIter, error)
	Config() (*config.Config, error)
	Fetch(o *git.FetchOptions) error
	Log(o *git.LogOptions) (object.CommitIter, error)
	ResolveRevision(rev plumbing.Revision) (*plumbing.Hash, error)
	Worktree() (*git.Worktree, error)
}

Jump to

Keyboard shortcuts

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