gittest

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitFileOpt added in v0.0.5

type CommitFileOpt func(*commitFileOpts)

func WithAmend added in v0.0.9

func WithAmend() CommitFileOpt

func WithMessage added in v0.0.5

func WithMessage(msg string) CommitFileOpt

type GitTestRepo added in v0.0.35

type GitTestRepo struct {
	RepoDir string
	GitDir  string
	GoGit   *git.Repository
}

func NewTempRepo

func NewTempRepo(t *testing.T) *GitTestRepo

NewTempRepo initializes a new git repository with reasonable defaults.

func NewTempRepoWithGitHubServer added in v0.0.36

func NewTempRepoWithGitHubServer(t *testing.T, serverURL string) *GitTestRepo

func (*GitTestRepo) AddFile added in v0.0.35

func (r *GitTestRepo) AddFile(t *testing.T, fp string)

func (*GitTestRepo) AsAvGitRepo added in v0.0.35

func (r *GitTestRepo) AsAvGitRepo() *avgit.Repo

func (*GitTestRepo) CheckoutBranch added in v0.0.35

func (r *GitTestRepo) CheckoutBranch(t *testing.T, branch plumbing.ReferenceName) plumbing.ReferenceName

CheckoutBranch checks out the specified branch and returns the original branch.

func (*GitTestRepo) CheckoutCommit added in v0.0.35

func (r *GitTestRepo) CheckoutCommit(t *testing.T, hash plumbing.Hash)

func (*GitTestRepo) CommitFile added in v0.0.35

func (r *GitTestRepo) CommitFile(
	t *testing.T,
	filename string,
	body string,
	cfOpts ...CommitFileOpt,
) plumbing.Hash

func (*GitTestRepo) CreateFile added in v0.0.35

func (r *GitTestRepo) CreateFile(t *testing.T, filename string, body string) string

func (*GitTestRepo) CreateRef added in v0.0.35

func (r *GitTestRepo) CreateRef(t *testing.T, ref plumbing.ReferenceName)

func (*GitTestRepo) CurrentBranch added in v0.0.35

func (r *GitTestRepo) CurrentBranch(t *testing.T) plumbing.ReferenceName

func (*GitTestRepo) GetCommitAtRef added in v0.0.35

func (r *GitTestRepo) GetCommitAtRef(t *testing.T, name plumbing.ReferenceName) plumbing.Hash

func (*GitTestRepo) GetCommits added in v0.0.35

func (r *GitTestRepo) GetCommits(t *testing.T, includedFromRef, excludedFromRef plumbing.ReferenceName) []plumbing.Hash

func (*GitTestRepo) Git added in v0.0.35

func (r *GitTestRepo) Git(t *testing.T, args ...string) string

func (*GitTestRepo) IsWorkdirClean added in v0.0.35

func (r *GitTestRepo) IsWorkdirClean(t *testing.T) bool

func (*GitTestRepo) MergeBase added in v0.0.35

func (r *GitTestRepo) MergeBase(t *testing.T, ref1, ref2 plumbing.ReferenceName) []plumbing.Hash

func (*GitTestRepo) OpenDB added in v0.0.35

func (r *GitTestRepo) OpenDB(t *testing.T) *jsonfiledb.DB

func (*GitTestRepo) WithCheckoutBranch added in v0.0.35

func (r *GitTestRepo) WithCheckoutBranch(t *testing.T, branch plumbing.ReferenceName, f func())

WithCheckoutBranch runs the given function after checking out the specified branch. It returns to the original branch after the function returns.

Jump to

Keyboard shortcuts

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