git

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const RemoteGitUrlRegex = "((git|ssh|http(s)?)|(git@[\\w\\.]+))(:(//)?)([\\w\\.@\\:/\\-~]+)(\\.git)(/)?"

Variables

View Source
var InvalidReferenceErr = errors.New("invalid remote reference")
View Source
var (
	RemoteGitUrlErr = errors.New("invalid git remote repository url")
)

Functions

This section is empty.

Types

type BranchName

type BranchName string

type CloneOps

type CloneOps struct {
	Remote RemoteGitUrl
	Path   string
	Refs   BranchName
}

type Git

type Git interface {
	Clone(ops CloneOps) error
	ListRemotes(repo Repo) ([]Remote, error)
	Fetch(repo Repo) error
	Status(repo Repo) (StatusRes, error)
	CurrentBranch(repo Repo) (BranchName, error)
	HasChanges(repo Repo) (bool, error)
	DiffersFromRemote(repo Repo) (bool, error)
	Switch(repo Repo, branch BranchName, force bool) error
	Pull(repo Repo, rebase bool) error
	PullBranch(repo Repo, branch BranchName, rebase bool) error
	ListBranches(repo Repo) ([]BranchName, error)
	CreateLightweightTag(repo Repo, tag string, branch BranchName) error
	PushTag(repo Repo, tag Tag, remote Remote) error
}

type Remote

type Remote string

type RemoteGitUrl

type RemoteGitUrl string

func NewRemoteGitUrl

func NewRemoteGitUrl(raw string) (RemoteGitUrl, error)

type Repo

type Repo struct {
	Remote RemoteGitUrl `yaml:"remote" json:"remote,omitempty"`
	Path   string       `yaml:"rel_path" json:"rel_path,omitempty"`
	Refs   BranchName   `yaml:"main_stream" json:"main_stream,omitempty"`
}

type StatusRes

type StatusRes struct {
	Change bool
	Branch BranchName
}

type Tag

type Tag string

Jump to

Keyboard shortcuts

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