git

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package git defines the functionality to interact with the git CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Git

type Git interface {
	// DiffDirsAbs returns the directories changed using the git diff command
	DiffDirsAbs(ctx context.Context, baseRef, headRef string) ([]string, error)
	// CloneRepository clones the repository to the workingDir.
	CloneRepository(ctx context.Context, githubToken, owner, repo string) error
}

Git defined the common git functionality.

type GitClient

type GitClient struct {
	// contains filtered or unexported fields
}

GitClient implements the git interface.

func NewGitClient

func NewGitClient(workingDir string) *GitClient

NewGitClient creates a new Terraform client.

func (*GitClient) CloneRepository

func (g *GitClient) CloneRepository(ctx context.Context, githubToken, owner, repo string) error

CloneRepository clones the repository to the workingDir.

func (*GitClient) DiffDirsAbs

func (g *GitClient) DiffDirsAbs(ctx context.Context, sourceRef, destRef string) ([]string, error)

DiffDirsAbs runs a git diff between two revisions and returns the sorted list of absolute directory paths that have changes.

type MockGitClient

type MockGitClient struct {
	DiffResp []string
	DiffErr  error
	CloneErr error
}

MockGitClient implements the git interface.

func (*MockGitClient) CloneRepository

func (m *MockGitClient) CloneRepository(ctx context.Context, githubToken, owner, repo string) error

CloneRepository clones the repository to the workingDir.

func (*MockGitClient) DiffDirsAbs

func (m *MockGitClient) DiffDirsAbs(ctx context.Context, baseRef, headRef string) ([]string, error)

DiffDirsAbs runs a git diff between two revisions and returns the list of directories with changes.

Jump to

Keyboard shortcuts

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