git_mock

package
v1.59.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRemote = "origin"

Variables

View Source
var ErrNotOnAnyBranch = errors.New("you're not on any Git branch (a 'detached HEAD' state).")

ErrNotOnAnyBranch indicates that the user is in detached HEAD state

Functions

func ParseDefaultBranch

func ParseDefaultBranch(output []byte) (string, error)

Types

type GitInterface

type GitInterface interface {
	CheckoutBranch(branch string) error
	CurrentBranch() (string, error)
	DeleteLocalBranch(branch string) error
	GetDefaultBranch(remote string) (string, error)
	RemoteBranchExists(branch string) (bool, error)
}

type StandardGitRunner

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

func NewStandardGitRunner

func NewStandardGitRunner(gitBinary string) *StandardGitRunner

func (*StandardGitRunner) CheckoutBranch

func (g *StandardGitRunner) CheckoutBranch(branch string) error

CheckoutBranch checks out a branch in the current git repository

func (*StandardGitRunner) CurrentBranch

func (g *StandardGitRunner) CurrentBranch() (string, error)

CurrentBranch reads the checked-out branch for the git repository

func (*StandardGitRunner) DeleteLocalBranch

func (g *StandardGitRunner) DeleteLocalBranch(branch string) error

DeleteLocalBranch deletes a local git branch

func (*StandardGitRunner) GetDefaultBranch

func (g *StandardGitRunner) GetDefaultBranch(remote string) (string, error)

GetDefaultBranch finds and returns the remote's default branch

func (*StandardGitRunner) RemoteBranchExists

func (g *StandardGitRunner) RemoteBranchExists(branch string) (bool, error)

RemoteBranchExists returns a boolean if the remote branch exists

Jump to

Keyboard shortcuts

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