git

package
v1.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst string) (int64, error)

Copy is a util function to copy file from one location to another

func ParseGithubURL

func ParseGithubURL(urlPath string) (string, string)

ParseRepoURL breaks a path into repo and filepath eg: for /practo/tipoca-stream/pkg/README.md this: "practo/tipoca-stream" and "pkg/README.md"

func ParseURL

func ParseURL(pathOrURL string) (*url.URL, error)

Types

type Git

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

func (*Git) Checkout

func (g *Git) Checkout(hash string) error

func (*Git) Clone

func (g *Git) Clone() error

func (*Git) Log

func (g *Git) Log(fileName string, numberOfCommits int) ([]string, error)

func (*Git) Pull

func (g *Git) Pull() error

type GitCache

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

func (*GitCache) GetFileLocalPath

func (g *GitCache) GetFileLocalPath(filePath string) string

GetFileLocalPath takes the relative path of the file from repo and returns the local path the file should be present if downloaded

func (*GitCache) GetFileVersion

func (g *GitCache) GetFileVersion(filePath string) (string, error)

GetVersion returns the latest version of the repo file it fetches the latest version every cacheValidity seconds and keeps a cache

type GitCacheInterface

type GitCacheInterface interface {
	GetFileVersion(filePath string) (string, error)
	GetFileLocalPath(filepath string) string
}

func NewGitCache

func NewGitCache(repoURL string, accessToken string) (GitCacheInterface, error)

type GitInterface

type GitInterface interface {
	Clone() error
	Pull() error
	Checkout(hash string) error
	Log(fileName string, numberOfCommits int) ([]string, error)
}

func New

func New(dir string, repoURL string, accessToken string) GitInterface

Jump to

Keyboard shortcuts

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