git

package
v0.0.0-...-855de17 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDirExists = errors.New("dir exists")

Functions

This section is empty.

Types

type GitCommitConfig

type GitCommitConfig struct {
	BranchNameBase string
	BranchName     string `json:"-",toml:"-",yaml:"-"`
	Title          string
	Body           string
	AuthorName     string
	Email          string
	Time           time.Time `json:"-",toml:"-",yaml:"-"`
}

type GitConfig

type GitConfig struct {
	Provider string
	BasePath string
	*GitCommitConfig
	AddPaths   *remote.MatchTextSpec
	AddContent *remote.MatchTextSpec
	StripeList StripeList
}

type GitProvider

type GitProvider interface {
	SetBase(ppath string) (err error)
	SetClient(client *http.Client) (err error)
	Clone(repo *remote.RepoT) (err error) // Path to repo (name), this will be used by the FmtConfig.Commands and FmtConfig.Target
	Status(dirPath string) (dirty bool, gitStatus string, err error)
	Add(dirPath string, filePath string) (err error)
	CommitWithBranch(dirPath string, commit *GitCommitConfig) (hash, status string, err error)
	PushAll(dirPath, remoteUrl, branchName string) (err error)
}

type GoGit

type GoGit struct {
	BasePath string
}

func NewGoGit

func NewGoGit() GoGit

func (GoGit) Add

func (g GoGit) Add(dirPath, filePath string) (err error)

func (GoGit) Clone

func (g GoGit) Clone(repo *remote.RepoT) (err error)

func (GoGit) CommitWithBranch

func (g GoGit) CommitWithBranch(dirPath string, commit *GitCommitConfig) (hash, status string, err error)

func (GoGit) PushAll

func (g GoGit) PushAll(dirPath, remote, branchName string) (err error)

func (GoGit) SetBase

func (g GoGit) SetBase(ppath string) (err error)

func (GoGit) SetClient

func (g GoGit) SetClient(c *http.Client) error

func (GoGit) Status

func (g GoGit) Status(dirPath string) (dirty bool, statusString string, err error)

type StripeList

type StripeList []string

TODO: StripeList A stripelist is a list of regex strings (MustCompile), that must yield named matches "OWNER" and "REPO". After fmting, all dirty files (white/blacklist agnostic) will be matched against this regex. Resulting OWNER/REPO results will be forwarded to the repo service for fetching. This lets you exclude changes against, say, vendor/ directories in your commit, and instead track down those sources for formatting themselves. eg. M\s*(|\/)vendor\/github\.com\/(?P<OWNER>\w*)\/(?P<REPO>[\w-]*\b) https://regex101.com/r/BweS5r/2

Jump to

Keyboard shortcuts

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