localgit

package
v0.0.853 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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. Launch 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.

func (*LocalGit) RevParse

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

RevParse does git rev-parse.

Jump to

Keyboard shortcuts

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