git

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RemoteName   = "origin"
	TagPrefix    = "refs/tags/"
	BranchPrefix = "refs/heads/"
	MainBranch   = "refs/heads/main"
)

Variables

View Source
var (
	ErrCheckoutFailed          = errors.New("failed to checkout repository")
	ErrFetchFailed             = errors.New("failed to fetch repository")
	ErrPullFailed              = errors.New("failed to pull repository")
	ErrRepositoryAlreadyExists = git.ErrRepositoryAlreadyExists
	ErrInvalidReference        = git.ErrInvalidReference
)

Functions

func CloneRepository

func CloneRepository(path, url, ref string, skipTLSVerify bool) (*git.Repository, error)

CloneRepository clones a repository from a given URL and reference to a temporary directory

func GetAuthUrl

func GetAuthUrl(url, authType, token string) string

GetAuthUrl returns a clone URL with an access token for private repositories

func UpdateRepository added in v0.16.0

func UpdateRepository(path, ref string, skipTLSVerify bool) (*git.Repository, error)

UpdateRepository updates a local repository by

  1. fetching the latest changes from the remote
  2. checking out the specified reference (branch or tag)
  3. pulling the latest changes from the remote
  4. returning the updated repository

Allowed reference forma

  • Branches: refs/heads/main or main
  • Tags: refs/tags/v1.0.0 or v1.0.0

Types

This section is empty.

Jump to

Keyboard shortcuts

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