common

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIncludeRefs = "refs/heads"

DefaultIncludeRefs is reference path that is indexed by default.

Variables

View Source
var ErrInvalidPositionFooter = errors.New("Invalid position footer format")

ErrInvalidPositionFooter is returned when there is matching position footer key, but its value doesn't match expected format.

View Source
var ErrNoPositionFooter = errors.New("No position footer found")

ErrNoPositionFooter is returned when no matching position footer is found in commit.

Functions

This section is empty.

Types

type CommitPosition

type CommitPosition struct {
	// Name is either ref name for commits created after SVN-Git
	// transition, or SVN URL/branch name for commits before Git.
	Name string
	// Sequential number.
	Number int
}

CommitPosition is extracted from Git commit message and it uniquely identifies a commit.

type GitCommit

type GitCommit struct {
	Repository    GitRepository
	Hash          string
	CommitMessage string
	// contains filtered or unexported fields
}

GitCommit holds information about single Git commit.

func (*GitCommit) GetFooters

func (c *GitCommit) GetFooters(name string) []string

GetFooters parses git commit message and extracts desired footers. A footer must contain key and value separated by a colon.

func (*GitCommit) GetPositionNumber

func (c *GitCommit) GetPositionNumber() (*CommitPosition, error)

GetPositionNumber looks for Cr-Commit-Position or git-svn-id in commit message and returns number in that line. If there are multiple matching lines, the last instance is returned.

func (*GitCommit) ID

func (c *GitCommit) ID() string

ID uniquely identifies commit.

type GitRepository

type GitRepository struct {
	// Host identifies GoB host, usually only subdomain portion of
	// googlesource.com. Example: chromium, pdfium
	Host string
	// Name is name of Git repository. Example: chromium/src
	Name string
	// Config is a snapshot of config.Repository. It may not be up-to-date.
	Config *config.Repository
}

GitRepository uniquely identifies a repository and has reference to config, if present.

func (*GitRepository) ShouldIndex

func (r *GitRepository) ShouldIndex(ref string) bool

ShouldIndex returns true if given reference should be indexed.

Jump to

Keyboard shortcuts

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