git

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package git contains functions for interacting with Git repositories using the Git CLI. As such, this package requires the Git CLI to be installed on the system.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoHeadBranch is returned when a repository's HEAD (aka default) branch cannot
	// be determine
	ErrNoHeadBranch = errors.New("failed to find a head branch, does one exist?")

	// ErrNoRemoteHeadBranch is returned when a repository's remote  default/HEAD branch
	// cannot be determined.
	ErrNoRemoteHeadBranch = errors.New("failed to get head branch from remote origin")
)

This block contains errors and regexes

Functions

func Clone

func Clone(ctx context.Context, ref, url string) (string, error)

Clone clone a git repository to a temporary directory and returns the path to the repository. If ref is empty, the default branch will be used. A shallow clone is performed.

func GetDefaultBranch

func GetDefaultBranch(ctx context.Context, path string) (string, error)

GetDefaultBranch determines the default/HEAD branch for a given git repository.

func ListRemote

func ListRemote(ctx context.Context, remote string) ([][]string, error)

ListRemote returns a list of all remotes as shown from running 'git ls-remote'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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