gittest

package
v6.0.0-...-34bcd8e Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: MIT Imports: 11 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, 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) Clone

func (r *TestRepository) Clone() (*TestRepository, error)

Clone clones the current TestRepository to a temporary directory and returns the clone of that repository. This method is useful when testing on repository that are expected to have a configured remote.

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