git

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MPL-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const WegoAppDir = "apps"

WegoAppDir is where applications information will live in the GitOps repo

View Source
const WegoClusterDir = "clusters"

WegoClusterDir is where cluster information and manifests will live in the GitOps repo

View Source
const WegoClusterOSWorkloadDir = "system"

WegoClusterOSWorkloadDir is where OS workload manifests will live in the GitOps repo

View Source
const WegoClusterUserWorloadDir = "user"

WegoClusterUserWorloadDir is where user workload manifests will live in the GitOps repo

View Source
const WegoRoot = ".weave-gitops"

WegoRoot is the default root directory for the GitOps repo

Variables

View Source
var (
	ErrNoGitRepository = errors.New("no git repository")
	ErrNoStagedFiles   = errors.New("no staged files")
)

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	Email string
}

type Commit

type Commit struct {
	Author
	Hash    string
	Message string
}

type Git

type Git interface {
	Open(path string) (*gogit.Repository, error)
	Init(path, url, branch string) (bool, error)
	Clone(ctx context.Context, path, url, branch string) (bool, error)
	Write(path string, content []byte) error
	Remove(path string) error
	Commit(message Commit, filters ...func(string) bool) (string, error)
	Push(ctx context.Context) error
	Status() (bool, error)
	Head() (string, error)
	GetRemoteUrl(dir string, remoteName string) (string, error)
	ValidateAccess(ctx context.Context, url string, branch string) error
}

Git is an interface for basic Git operations on a single branch of a remote repository.

func New

func New(auth transport.AuthMethod, wrapper wrapper.Git) Git

type GoGit

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

func (*GoGit) Clone

func (g *GoGit) Clone(ctx context.Context, path, url, branch string) (bool, error)

Clone clones a starting repository URL to a path, and checks out the provided branch name.

If the directory is successfully initialised, it returns true, otherwise it returns false.

func (*GoGit) Commit

func (g *GoGit) Commit(message Commit, filters ...func(string) bool) (string, error)

func (*GoGit) GetRemoteUrl added in v0.2.3

func (g *GoGit) GetRemoteUrl(dir string, remoteName string) (string, error)

GetRemoteUrl returns the url of the first listed remote server

func (*GoGit) Head

func (g *GoGit) Head() (string, error)

func (*GoGit) Init

func (g *GoGit) Init(path, url, branch string) (bool, error)

Init initialises the directory at path with the remote and branch provided.

If the directory is successfully initialised it returns true, otherwise if the directory is already initialised, it returns false.

func (*GoGit) Open

func (g *GoGit) Open(path string) (*gogit.Repository, error)

Open opens a git repository in the provided path, and returns a repository.

func (*GoGit) Push

func (g *GoGit) Push(ctx context.Context) error

func (*GoGit) Remove added in v0.2.2

func (g *GoGit) Remove(path string) error

Remove removes the file at path

func (*GoGit) Status

func (g *GoGit) Status() (bool, error)

Status returns true if no files in the repository have been modified.

func (*GoGit) ValidateAccess added in v0.2.3

func (g *GoGit) ValidateAccess(ctx context.Context, url string, branch string) error

func (*GoGit) Write

func (g *GoGit) Write(path string, content []byte) error

Write writes the provided content to the path, if the file exists, it will be truncated.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
wrapperfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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