gittest

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gittest provides basic types and functions for testing operations related to Git repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestRepository

type TestRepository struct {
	*git.Repository
	Path    string
	Counter int
}

func NewRepository

func NewRepository() (testRepository *TestRepository, err error)

NewRepository creates a new TestRepository.

func (*TestRepository) AddCommit

func (r *TestRepository) AddCommit(commitType string) (plumbing.Hash, error)

AddCommit adds a new commit with a given conventional commit type to the underlying Git repository.

func (*TestRepository) AddTag

func (r *TestRepository) AddTag(tagName string, hash plumbing.Hash) error

AddTag adds a new tag to the underlying Git repository with a given name and pointing to a given hash.

func (*TestRepository) CheckoutBranch

func (r *TestRepository) CheckoutBranch(name string) error

CheckoutBranch creates a new branch with the given name and checkout to it.

func (*TestRepository) Remove

func (r *TestRepository) Remove() error

Remove removes the underlying Git repository.

func (*TestRepository) When

func (r *TestRepository) When() time.Time

When returns a time.Time starting at 2000/01/01 00:00:00 and increasing of 10 second every new call.

Jump to

Keyboard shortcuts

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