git

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthToRemoteMap = map[AuthMethod]RemoteType{
	AuthMethodToken:     RemoteTypeHttps,
	AuthMethodPublicKey: RemoteTypeSsh,
}
View Source
var ErrInvalidAuthMethod = fmt.Errorf("not a valid AuthMethod, try [%s]", strings.Join(_AuthMethodNames, ", "))
View Source
var ErrInvalidRemoteType = fmt.Errorf("not a valid RemoteType, try [%s]", strings.Join(_RemoteTypeNames, ", "))

Functions

func AuthMethodNames

func AuthMethodNames() []string

AuthMethodNames returns a list of possible string values of AuthMethod.

func RemoteTypeNames

func RemoteTypeNames() []string

RemoteTypeNames returns a list of possible string values of RemoteType.

Types

type AuthMethod

type AuthMethod string

ENUM( public-key token )

const (
	// AuthMethodPublicKey is a AuthMethod of type public-key.
	AuthMethodPublicKey AuthMethod = "public-key"
	// AuthMethodToken is a AuthMethod of type token.
	AuthMethodToken AuthMethod = "token"
)

func ParseAuthMethod

func ParseAuthMethod(name string) (AuthMethod, error)

ParseAuthMethod attempts to convert a string to a AuthMethod.

func (AuthMethod) IsValid

func (x AuthMethod) IsValid() bool

String implements the Stringer interface.

func (AuthMethod) MarshalText

func (x AuthMethod) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (AuthMethod) String

func (x AuthMethod) String() string

String implements the Stringer interface.

func (*AuthMethod) UnmarshalText

func (x *AuthMethod) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Config

type Config struct {
	Logger            zerolog.Logger
	Path              string
	Remote            string
	AuthMethod        string
	AuthKeyPath       string
	AuthToken         string
	AuthTokenUsername string
}

type GitRepo

type GitRepo struct {
	// contains filtered or unexported fields
}

func NewGitRepo

func NewGitRepo(config Config) (*GitRepo, error)

func (*GitRepo) CommitsSinceHash

func (g *GitRepo) CommitsSinceHash(hashStr string) ([]string, error)

func (*GitRepo) ForcePushTags

func (g *GitRepo) ForcePushTags() error

func (*GitRepo) GetHashForBranch

func (g *GitRepo) GetHashForBranch(branch string) (string, error)

func (*GitRepo) IsTagbotDisabled

func (g *GitRepo) IsTagbotDisabled() (bool, error)

func (*GitRepo) LatestTag

func (g *GitRepo) LatestTag() (*Tag, error)

func (*GitRepo) MakeTagHead

func (g *GitRepo) MakeTagHead(name string) error

func (*GitRepo) PushTags

func (g *GitRepo) PushTags() error

func (*GitRepo) RemakeTagHead

func (g *GitRepo) RemakeTagHead(name string) error

type RemoteType

type RemoteType string

ENUM( ssh https )

const (
	// RemoteTypeSsh is a RemoteType of type ssh.
	RemoteTypeSsh RemoteType = "ssh"
	// RemoteTypeHttps is a RemoteType of type https.
	RemoteTypeHttps RemoteType = "https"
)

func ParseRemoteType

func ParseRemoteType(name string) (RemoteType, error)

ParseRemoteType attempts to convert a string to a RemoteType.

func (RemoteType) IsValid

func (x RemoteType) IsValid() bool

String implements the Stringer interface.

func (RemoteType) MarshalText

func (x RemoteType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (RemoteType) String

func (x RemoteType) String() string

String implements the Stringer interface.

func (*RemoteType) UnmarshalText

func (x *RemoteType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Repo

type Repo interface {
	LatestTag() (*Tag, error)
	CommitsSinceHash(hash string) ([]string, error)
	MakeTagHead(name string) error
	RemakeTagHead(name string) error
	PushTags() error
	ForcePushTags() error
	GetHashForBranch(branch string) (string, error)
	IsTagbotDisabled() (bool, error)
}

type Tag

type Tag struct {
	Hash string
	Tag  *semver.Version
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳