simulator

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: MIT Imports: 8 Imported by: 0

README

go-git-simulator

Setup git repositories for testing purposes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvanceTime

type AdvanceTime struct {
	Duration time.Duration
}

func (AdvanceTime) Apply

func (op AdvanceTime) Apply(_ *testing.T, state *RepoState)

type BranchAndCheckout

type BranchAndCheckout struct {
	Name          string
	AdvanceTimeBy *time.Duration
}

func (BranchAndCheckout) Apply

func (op BranchAndCheckout) Apply(t *testing.T, state *RepoState)

type Checkout

type Checkout struct {
	Name          string
	AdvanceTimeBy *time.Duration
}

func (Checkout) Apply

func (op Checkout) Apply(t *testing.T, state *RepoState)

type CheckoutTag added in v0.3.0

type CheckoutTag struct {
	Name string
}

func (CheckoutTag) Apply added in v0.3.0

func (op CheckoutTag) Apply(t *testing.T, state *RepoState)

type Commit

type Commit struct {
	Message       string
	Author        *object.Signature
	AdvanceTimeBy *time.Duration
}

func (Commit) Apply

func (op Commit) Apply(t *testing.T, state *RepoState)

type InitRepo

type InitRepo struct {
	DefaultBranch string
	AdvanceTimeBy *time.Duration
}

func (InitRepo) Apply

func (op InitRepo) Apply(t *testing.T, state *RepoState)

type NewFile

type NewFile struct {
	Path          string
	Content       string
	AdvanceTimeBy *time.Duration
}

func (NewFile) Apply

func (op NewFile) Apply(t *testing.T, state *RepoState)

type RepoOperation

type RepoOperation interface {
	Apply(t *testing.T, state *RepoState)
}

type RepoState

type RepoState struct {
	Path     string
	Repo     *git.Repository
	Worktree *git.Worktree
	LastHash plumbing.Hash
	Now      time.Time

	DefaultAuthor      object.Signature
	DefaultBranch      string
	DefaultAdvanceTime time.Duration
}

func NewRepoState

func NewRepoState() *RepoState

func (*RepoState) WithDefaultAdvanceTime

func (state *RepoState) WithDefaultAdvanceTime(duration time.Duration) *RepoState

func (*RepoState) WithDefaultAuthor

func (state *RepoState) WithDefaultAuthor(name, email string) *RepoState

func (*RepoState) WithDefaultBranch

func (state *RepoState) WithDefaultBranch(name string) *RepoState

func (*RepoState) WithNow

func (state *RepoState) WithNow(now time.Time) *RepoState

func (*RepoState) WithPath

func (state *RepoState) WithPath(path string) *RepoState

type SetDefaultBranch added in v0.2.0

type SetDefaultBranch struct {
	DefaultBranch string
	AdvanceTimeBy *time.Duration
}

func (SetDefaultBranch) Apply added in v0.2.0

func (op SetDefaultBranch) Apply(t *testing.T, state *RepoState)

type Tag

type Tag struct {
	Name          string
	AdvanceTimeBy *time.Duration
}

func (Tag) Apply

func (op Tag) Apply(t *testing.T, state *RepoState)

type TagAnnotated

type TagAnnotated struct {
	Name          string
	Message       string
	Author        struct{ Name, Email string }
	AdvanceTimeBy *time.Duration
}

func (TagAnnotated) Apply

func (op TagAnnotated) Apply(t *testing.T, state *RepoState)

Jump to

Keyboard shortcuts

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