package git

import "github.com/oslokommune/okctl/pkg/git"

Package git knows how to do git operations

Index

Functions

func RepositoryURL

func RepositoryURL(org, repo string) string

RepositoryURL builds url based on org and repo

Types

type ActionFn

type ActionFn func(worktree *git.Worktree) error

ActionFn represents a function that makes changes

func AddFile

func AddFile(workingDir, fileName string, content []byte) ActionFn

AddFile is a helper action for adding a file to a repository

func RemoveFile

func RemoveFile(workingDir, fileName string) ActionFn

RemoveFile is a helper action for removing a file from a repository

type ChangeSet

type ChangeSet struct {
	Stager        RepositoryStagerFn
	Branch        string
	PushToRemote  bool
	FileSystem    billy.Filesystem
	CommitMessage string
	Actions       []ActionFn
}

ChangeSet contains the required inputs for updating a git repository

type Git

type Git struct{}

Git contains the state required for working with a git repository

func New

func New() *Git

New initializes a new Git

func (*Git) UpdateRepository

func (n *Git) UpdateRepository(c *ChangeSet) (*Result, error)

UpdateRepository applies the change set

type RemoteFileDeleter

type RemoteFileDeleter struct{}

RemoteFileDeleter knows how to delete a file in a remote Git repository

func (RemoteFileDeleter) Delete

func (RemoteFileDeleter) Delete(repositoryURL string, path string, commitMessage string) error

Delete deletes a file from a remote Git repository

type RepositoryStagerFn

type RepositoryStagerFn func(fs billy.Filesystem) (*git.Repository, error)

RepositoryStagerFn defines the required function for staging a git repository

func RepositoryStagerClone

func RepositoryStagerClone(repoURL string) RepositoryStagerFn

RepositoryStagerClone knows how to clone a git repository from a given URL

func RepositoryStagerInit

func RepositoryStagerInit(msg, fileName, content string, mem *memory.Storage) RepositoryStagerFn

RepositoryStagerInit initialises an empty repository

type Result

type Result struct {
	Branch             string
	ModifiedRepository bool
}

Result contains data about the created content

Source Files

api.go git.go

Directories

PathSynopsis
pkg/git/nameserverPackage nameserver knows how to create git commits for zone delegation and revocation
Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
12 packages
Last checked
18 hours ago

Tools for package owners.