git

package
v0.0.0-...-6cdb919 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitRefTypeBranch = "branch"
	GitRefTypeTag    = "tag"
	GitRefTypeCommit = "commit"
)

Variables

This section is empty.

Functions

func ExtractProjectPathFromURL

func ExtractProjectPathFromURL(gitURL string) (string, error)

ExtractProjectPathFromURL extract git project path from gitURL.

func Register

func Register(kind string, constructor Constructor)

Types

type Commit

type Commit struct {
	ID      string
	Message string
}

type Constructor

type Constructor func(ctx context.Context, config *git.Repo) (Helper, error)

type Helper

type Helper interface {
	// GetCommit to get commit of a branch/tag/commitID for a specified git URL
	GetCommit(ctx context.Context, gitURL string, refType string, ref string) (*Commit, error)
	ListBranch(ctx context.Context, gitURL string, params *SearchParams) ([]string, error)
	ListTag(ctx context.Context, gitURL string, params *SearchParams) ([]string, error)
	GetHTTPLink(gitURL string) (string, error)
	GetCommitHistoryLink(gitURL string, commit string) (string, error)
	GetTagArchive(ctx context.Context, gitURL, tagName string) (*Tag, error)
}

Helper interface to do git operations

func NewHelper

func NewHelper(ctx context.Context, config *git.Repo) (Helper, error)

type SearchParams

type SearchParams struct {
	Filter     string
	PageNumber int
	PageSize   int
}

SearchParams contains parameters for searching operation

type Tag

type Tag struct {
	ShortID     string
	Name        string
	ArchiveData []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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