gittest

package
v5.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 10 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
	RemoteServer *http.Server
	RemoteURL    string
	Path         string
	Counter      uint
}

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) AddCommitWithSpecificFile

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

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