git

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBranch

func GetBranch(localPath string) (string, error)

GetBranch retrieves the current HEADs name

func GetHash

func GetHash(ctx context.Context, localPath string) (string, error)

GetHash retrieves the current HEADs hash

func GetRemote

func GetRemote(localPath string) (string, error)

GetRemote retrieves the remote origin

Types

type CloneOptions

type CloneOptions struct {
	URL            string
	Tag            string
	Branch         string
	Commit         string
	Args           []string
	DisableShallow bool
}

type GitCLIRepository

type GitCLIRepository struct {
	LocalPath string
}

GitCLIRepository holds the information about a repository

func NewGitCLIRepository

func NewGitCLIRepository(ctx context.Context, localPath string) (*GitCLIRepository, error)

NewGitCLIRepository creates a new git repository struct with the given parameters

func (*GitCLIRepository) Clone

func (gr *GitCLIRepository) Clone(ctx context.Context, options CloneOptions) error

Clone pulls the repository or clones it into the local path

type GoGitRepository

type GoGitRepository struct {
	LocalPath string
	RemoteURL string
}

GoGitRepository holds the information about a repository

func NewGoGitRepository

func NewGoGitRepository(localPath string, remoteURL string) *GoGitRepository

NewGoGitRepository creates a new git repository struct with the given parameters

func (*GoGitRepository) Checkout

func (gr *GoGitRepository) Checkout(tag, branch, revision string) error

Checkout certain tag, branch or hash

func (*GoGitRepository) Update

func (gr *GoGitRepository) Update(merge bool) error

Update pulls the repository or clones it into the local path

Jump to

Keyboard shortcuts

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