Help us shape the future of Go! Take the 2026 Go Developer Survey

git

package module
v0.0.0-...-0db611f Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ZeroHash = "0000000000000000000000000000000000000000"

ZeroHash is the null hash for git

Variables

View Source
var (
	DefaultAPIVersion = "v4"
)

Functions

func NewBasicAuth

func NewBasicAuth(user, password string) (*basicAuth, error)

func NewDefaultActionContext

func NewDefaultActionContext(logger log.Logger, dryRun bool) gitActionContext

NewDefaultActionContext generate a default action context with a nil return for Data()

func NewGetAllCommits

func NewGetAllCommits(projectID string) actions.Action

func NewGetCommitsBetween

func NewGetCommitsBetween(projectID, start, end string) actions.Action

func NewGetCommitsBetweenForBranch

func NewGetCommitsBetweenForBranch(projectID, branch, start, end string) actions.Action

func NewGetCommitsBetweenForSubproject

func NewGetCommitsBetweenForSubproject(projectID, subprojectName, start, end string) actions.Action

func NewGetCommitsBetweenForSubprojectOnBranch

func NewGetCommitsBetweenForSubprojectOnBranch(projectID, subprojectName, branch, start, end string) actions.Action

func NewGetTagsAction

func NewGetTagsAction(projectID string) actions.Action

NewGetTagsAction get all tags for a gitlab project

func NewGetTagsForBranchAction

func NewGetTagsForBranchAction(projectID, branch string) actions.Action

NewGetTagsForBranchAction get tags for a branch, this is only useful if you are tagging prereleases eg v1.2.3-<branchName>.<timestamp>

func NewGetTagsForSubProjectAction

func NewGetTagsForSubProjectAction(projectID, subprojectName string) actions.Action

NewGetTagsForSubProjectAction get tags for a subproject when using a mono repo where you tag each subproject as <subprojectName>/<subProjectSemver> (eg projA/v1.2.3)

func NewGetTagsForSubprojectOnBranchAction

func NewGetTagsForSubprojectOnBranchAction(projectID, subprojectName, branch string) actions.Action

NewGetTagsForSubprojectOnBranchAction get tags for a branch, this is only useful if you are tagging prereleases and when using a mono repo where you tag each subproject as <subprojectName>/<subProjectSemver>-<branchName>.<timestamp> (eg projA/v1.2.3-featureA.20200523222454)

func NewNetRCAuth

func NewNetRCAuth(netrcFile, domain string) (n *netRCAuth, err error)

func NewNoAuth

func NewNoAuth() (*noAuth, error)

func NewSortTagsAction

func NewSortTagsAction(reverse bool) actions.Action

NewSortTagsAction get all tags for a gitlab project

Types

type Authenticator

type Authenticator interface {
	Type() GitAuth
	User() string
	Password() string
}

Authenticator Auth-s the initial connection then allows validation at any point of the stream

type Commit

type Commit struct {
	SHA     string
	Message string
	Time    *time.Time
	// File Paths touched by this commit
	Files []string
}

type Commits

type Commits []*Commit

func (*Commits) FromGitlab

func (c *Commits) FromGitlab(glCommits []*gitlab.Commit, client *gitlab.Client)

type GitAuth

type GitAuth int
const (
	NoAuth GitAuth = iota
	BasicAuth
	NetRCAuth
	OAuth
)

type GitClient

type GitClient interface {
	WithDomain(string) GitClient
	WithHTTPClient(*http.Client) GitClient
	WithAuth(Authenticator) GitClient
}

func NewGitlabClient

func NewGitlabClient() GitClient

NewGitlabClient return a gitlab GitlabClient that uses the local .netrc for the specified domain

type GitlabClient

type GitlabClient interface {
	Client() (*gitlab.Client, error)
}

type Tag

type Tag struct {
	Name    string
	SHA     string
	Version *semver.Version
}

type Tags

type Tags []*Tag

func (*Tags) FromGitlab

func (t *Tags) FromGitlab(glTags []*gitlab.Tag, client *gitlab.Client)

func (Tags) Len

func (v Tags) Len() int

Len return the number of messages in the slice required to implement sortable interface https://golang.org/pkg/sort/#Interface

func (Tags) Less

func (v Tags) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j. required to implement sortable interface https://golang.org/pkg/sort/#Interface

func (Tags) Swap

func (v Tags) Swap(i, j int)

Swap swaps the elements with indexes i and j. required to implement sortable interface https://golang.org/pkg/sort/#Interface

Jump to

Keyboard shortcuts

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