git

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package git makes a git repository out of a local directory, keeps the content committed when the directory content changes, and optionaly (if a remote repos url is provided), keep it in sync with a remote repository.

It requires the git command in $PATH, since the pure Go git implementations aren't up to the task (see go-git issues #793 and #785 for instance).

Index

Constants

This section is empty.

Variables

View Source
var (
	// TimeoutCommands defines the max execution time for git commands
	TimeoutCommands = 60 * time.Second

	// CheckInterval defines the interval between local directory checks
	CheckInterval = 10 * time.Second

	// GitAuthor is the name of the commiter
	GitAuthor = "Katafygio"

	// GitEmail is the email of the commiter
	GitEmail = "katafygio@localhost"

	// GitMsg is the commit message we'll use
	GitMsg = "Kubernetes cluster change"
)

Functions

This section is empty.

Types

type Store

type Store struct {
	Logger   logger
	LocalDir string
	URL      string
	Author   string
	Email    string
	Msg      string
	DryRun   bool
	// contains filtered or unexported fields
}

Store will maintain a git repository off dumped kube objects

func New

func New(log logger, dryRun bool, dir, url string) *Store

New instantiate a new git Store. url is optional.

func (*Store) CloneOrInit added in v0.4.0

func (s *Store) CloneOrInit() (err error)

CloneOrInit create a new local repository, either with "git clone" (if a GitURL to clone from is provided), or "git init" (in the absence of GitURL).

func (*Store) Commit

func (s *Store) Commit() (changed bool, err error)

Commit git commit all the directory's changes

func (*Store) Git

func (s *Store) Git(args ...string) error

Git wraps the git command

func (*Store) Push

func (s *Store) Push() error

Push git push to the origin

func (*Store) Start added in v0.2.0

func (s *Store) Start() (*Store, error)

Start maintains a directory content committed

func (*Store) Status

func (s *Store) Status() (changed bool, err error)

Status tests the git status of a repository

func (*Store) Stop added in v0.2.0

func (s *Store) Stop()

Stop stops the git goroutine

Jump to

Keyboard shortcuts

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