git

package
v0.22.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTag

func CreateTag(dir, tag string) error

func FindForkPoint added in v0.9.0

func FindForkPoint(repo *git.Repository, branchRef, upstreamRef *plumbing.Reference) (*plumbing.Hash, error)

FindForkPoint finds the fork point between the local branch and the upstream branch.

The fork point is the commit hash of the latest commit had in common between the local branch and the upstream branch.

The local branch is the branch pointed to by the provided branchRef.

The upstream branch is the branch pointed to by the provided upstreamRef.

The caller is responsible for closing the provided repo.

func GetGitAuth

func GetGitAuth(gitURL string) (*gitHttp.BasicAuth, error)

func GetGitAuthorSignature

func GetGitAuthorSignature() *object.Signature

func GetVersionFromTag

func GetVersionFromTag(dir string, index int) (*version.Version, error)

GetVersionFromTag sorts git tags and returns the provided index e.g. index=1 will return the most recent tag

func PushTag

func PushTag(dir, tagName string) error

func SetGitSignOptions

func SetGitSignOptions(repoPath string) error

func TempClone added in v0.9.0

func TempClone(gitURL, hash string, useAuth bool) (repoDir string, err error)

TempClone clones the repo using the provided HTTPS URL to a temp directory, and returns the path to the temp directory.

If hash is non-empty, the repo will be checked out to that commit hash.

If user authentication is requested, a personal access token will be read in from the GITHUB_TOKEN environment variable.

The caller is responsible for cleaning up the temp directory.

Types

type URL

type URL struct {
	Scheme       string
	Host         string
	Organisation string
	Name         string
	RawURL       string
}

func GetRemoteURL

func GetRemoteURL(repo *git.Repository) (*URL, error)

func GetRemoteURLFromDir

func GetRemoteURLFromDir(dir string) (*URL, error)

func ParseGitURL

func ParseGitURL(rawURL string) (*URL, error)

ParseGitURL returns owner, repo name, errors

Jump to

Keyboard shortcuts

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