gittest

package
v0.26.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockGitProvider

func MockGitProvider(
	t *testing.T,
	repoID string,
	expectedDeployKeyTitle string,
	expectedPrRequests []vcs.PullRequestRequest,
	havePRs []vcs.PullRequestRequest,
) (*httptest.Server, *http.Client)

Types

type FakeRepository

type FakeRepository struct {
	RepoPath  string
	PullError error

	CommitsMade []string
	// contains filtered or unexported fields
}

func (*FakeRepository) Commit

func (f *FakeRepository) Commit(file string, message string) (string, error)

func (*FakeRepository) CreatePullRequest

func (f *FakeRepository) CreatePullRequest(
	title string,
	desc string,
	src string,
	dst string,
) error

func (*FakeRepository) CurrentBranch

func (f *FakeRepository) CurrentBranch() (string, error)

func (*FakeRepository) DeleteLocalBranch

func (f *FakeRepository) DeleteLocalBranch(branch string) error

func (*FakeRepository) Path

func (f *FakeRepository) Path() string

func (*FakeRepository) Pull

func (f *FakeRepository) Pull() (string, error)

func (*FakeRepository) Push

func (f *FakeRepository) Push(src string, dst string) error

func (*FakeRepository) RepoID

func (f *FakeRepository) RepoID() string

func (*FakeRepository) SwitchBranch

func (f *FakeRepository) SwitchBranch(branch string, create bool) error

type LocalGitRepository

type LocalGitRepository struct {
	Repository *git.Repository
	Worktree   *git.Worktree
	Directory  string
}

func InitGitRepository

func InitGitRepository(
	t testing.TB,
	remoteDir string,
	dir string,
	branch string,
) (*LocalGitRepository, error)

func SetupGitRepository

func SetupGitRepository(t testing.TB, branch string) (*LocalGitRepository, error)

func (*LocalGitRepository) CommitFile

func (r *LocalGitRepository) CommitFile(file string, message string) (string, error)

func (*LocalGitRepository) CommitNewFile

func (r *LocalGitRepository) CommitNewFile(file string, message string) (string, error)

Jump to

Keyboard shortcuts

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