git

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package git provides git repository service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	// Hash is a commit hash string.
	Hash string
	// Message is a commit message.
	Message string
	// Author is a commit author.
	Author string
	// Version is a commit version (for tag only).
	Version version.V
	// Date is a commit date.
	Date time.Time
	// Email is an user email.
	Email string
	// IsMerge is a merge flag.
	IsMerge bool
}

Commit is a commit wrapper for return to external services.

func (Commit) AuthorHref

func (c Commit) AuthorHref() string

AuthorHref returns a commit Author href.

func (Commit) IsTag

func (c Commit) IsTag() bool

IsTag returns true if the commit is tagged.

func (Commit) String

func (c Commit) String() string

String returns a commit string.

type CommitsArgs

type CommitsArgs struct {
	NextV         version.V
	LastOnly      bool
	IncludeMerges bool
}

CommitsArgs is a Commits options.

type NextType

type NextType int

NextType is a next version type.

const (
	NextNone   NextType = iota // NextNone is a next version type none (invalid).
	NextMajor  NextType = iota // NextMajor is a next version type major.
	NextMinor                  // NextMinor is a next version type minor.
	NextPatch                  // NextPatch is a next version type patch.
	NextCustom                 // NextCustom is a next version type custom (need to set custom version).
)

NextType values.

type RepoOptions

type RepoOptions struct {
	Path string
	Repo *git.Repository
}

RepoOptions is a Repository options.

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository is a git repository wrapper.

func NewRepository

func NewRepository(opts ...func(options *RepoOptions)) (*Repository, error)

NewRepository returns a new Repository.

func (Repository) Add

func (r Repository) Add(files ...fsys.File) error

Add files to the index. files is list from path to files FROM WORKDIR.

func (Repository) AddModified

func (r Repository) AddModified() error

AddModified adds modified files to the index.

func (Repository) CheckDowngrade

func (r Repository) CheckDowngrade(v version.V) error

CheckDowngrade checks if the version is not downgraded.

func (Repository) CommitTag

func (r Repository) CommitTag(v version.V) error

CommitTag stores a tag and commit changes.

func (Repository) Commits

func (r Repository) Commits(opt ...func(options *CommitsArgs)) ([]Commit, error)

Commits returns commits. If nextV is set, then the tag with this version is not created yet and nextV - new created version. In this case will ber returned commits from last tag to HEAD and last commit will be with nextV. If nextV is not set, then will be returned all commits.

func (Repository) Current

func (r Repository) Current() (version.V, error)

Current returns a current version.

func (Repository) IsClean

func (r Repository) IsClean() (bool, error)

IsClean returns true if all the files are in Unmodified status.

func (Repository) NextVersion

func (r Repository) NextVersion(nt NextType, custom version.V) (_ version.V, exists bool, _ error)

NextVersion returns a next version.

func (Repository) RemoteURL

func (r Repository) RemoteURL() (string, error)

RemoteURL returns a repository name.

func (Repository) Repo

func (r Repository) Repo() *git.Repository

Repo returns a git repository.

Jump to

Keyboard shortcuts

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