gitutil

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoGitBinary is an error returned when no git binary is found.
	ErrNoGitBinary = errors.New("No git binary found")
	// ErrNotAGitDir is an error returned when a given directory is not a git dir.
	ErrNotAGitDir = errors.New("Not a git directory")
	// ErrCouldNotDetectRemote is an error returned when git remote could not be detected or parsed.
	ErrCouldNotDetectRemote = errors.New("Could not auto-detect or parse Git remote URL")
	// ErrCouldNotDetectGitHash is an error returned when git hash could not be detected.
	ErrCouldNotDetectGitHash = errors.New("Could not auto-detect or parse Git hash")
	// ErrCouldNotDetectGitShortHash is an error returned when git short hash could not be detected.
	ErrCouldNotDetectGitShortHash = errors.New("Could not auto-detect or parse Git short hash")
	// ErrCouldNotDetectGitBranch is an error returned when git branch could not be detected.
	ErrCouldNotDetectGitBranch = errors.New("Could not auto-detect or parse Git branch")
	// ErrCouldNotDetectGitTags is an error returned when git tags could not be detected.
	ErrCouldNotDetectGitTags = errors.New("Could not auto-detect or parse Git tags")
	// ErrCouldNotDetectGitRefs is an error returned when git refs could not be detected.
	ErrCouldNotDetectGitRefs = errors.New("Could not auto-detect or parse Git refs")
)

Functions

func ConfigEmail added in v0.6.28

func ConfigEmail(ctx context.Context) (string, error)

ConfigEmail returns the user's currently configured (global) email address

func ParseCoAuthorsFromBody added in v0.6.26

func ParseCoAuthorsFromBody(body string) []string

ParseCoAuthorsFromBody returns a list of coauthor emails from a git body

func ParseGitRemoteURL

func ParseGitRemoteURL(gitURL string) (string, error)

ParseGitRemoteURL converts a gitURL like user@host.com:path/to.git or https://host.com/path/to.git to host.com/path/to

func ReferenceWithGitMeta

func ReferenceWithGitMeta(ref domain.Reference, gitMeta *GitMetadata) domain.Reference

ReferenceWithGitMeta applies git metadata to the target naming.

Types

type GitMetadata

type GitMetadata struct {
	BaseDir              string
	RelDir               string
	RemoteURL            string
	GitURL               string
	Hash                 string
	ShortHash            string
	BranchOverrideTagArg bool
	Branch               []string
	Tags                 []string
	CommitterTimestamp   string
	AuthorTimestamp      string
	AuthorEmail          string
	AuthorName           string
	CoAuthors            []string
	Refs                 []string
}

GitMetadata is a collection of git information about a certain directory.

func Metadata

func Metadata(ctx context.Context, dir, gitBranchOverride string) (*GitMetadata, error)

Metadata performs git metadata detection on the provided directory.

func (*GitMetadata) Clone

func (gm *GitMetadata) Clone() *GitMetadata

Clone returns a copy of the GitMetadata object.

Jump to

Keyboard shortcuts

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