localgit

package
v0.0.0-...-185445a Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package localgit creates a local git repo that can be used for testing code that uses a git.Client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalGit

type LocalGit struct {
	// Dir is the path to the base temp dir. Repos are at Dir/org/repo.
	Dir string
	// Git is the location of the git binary.
	Git string
}

LocalGit stores the repos in a temp dir. Create with New and delete with Clean.

func New

func New() (*LocalGit, *git.Client, error)

New creates a LocalGit and a git.Client pointing at it.

func (*LocalGit) AddCommit

func (lg *LocalGit) AddCommit(org, repo string, files map[string][]byte) error

AddCommit adds the files to a new commit in the repo.

func (*LocalGit) Checkout

func (lg *LocalGit) Checkout(org, repo, commitlike string) error

Checkout does git checkout.

func (*LocalGit) CheckoutNewBranch

func (lg *LocalGit) CheckoutNewBranch(org, repo, branch string) error

CheckoutNewBranch does git checkout -b.

func (*LocalGit) Clean

func (lg *LocalGit) Clean() error

Clean deletes the local git dir.

func (*LocalGit) MakeFakeRepo

func (lg *LocalGit) MakeFakeRepo(org, repo string) error

MakeFakeRepo creates the given repo and makes an initial commit.

Jump to

Keyboard shortcuts

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