git

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Git

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

func NewGit

func NewGit(opts *Options) (*Git, error)

func (*Git) Add

func (g *Git) Add(files ...string) error

func (*Git) Clone

func (g *Git) Clone() error

func (*Git) Commit

func (g *Git) Commit(commitMessage string) error

func (*Git) Fetch

func (g *Git) Fetch() error

func (*Git) GetHEADCommitHash

func (g *Git) GetHEADCommitHash() (string, error)

func (*Git) GetRemoteHEADCommitHash added in v0.0.3

func (g *Git) GetRemoteHEADCommitHash() (string, error)

func (*Git) GetRemoteURL

func (g *Git) GetRemoteURL() (string, error)

func (*Git) PullRebase

func (g *Git) PullRebase() error

PullRebase pulls and rebases.

func (*Git) Push

func (g *Git) Push() error

func (*Git) Status added in v0.0.3

func (g *Git) Status() (string, error)

type Options

type Options struct {
	// AbsLocalPath is the path of the directory to clone to.
	AbsLocalPath,

	RemoteURL,

	BranchName,

	AuthorName,

	AuthorEmail,

	GithubToken string

	// Github SSH private key file
	GithubSSHPrivkeyFilename string

	// IsEnsureEmptyDirectory ensures the local directory is empty before cloning to it.
	IsEnsureEmptyDirectory bool

	// SyncPeriod is the period in which synchronization with the git repository is guaranteed.
	SyncPeriod time.Duration

	// Whether to write certificates into the Git repository (will be false when only pushing certs to other storages)
	PushCertificates bool

	// Do not push to remote repository (but still write to the local Git clone)
	DryRun bool
}

type RepositorySyncer

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

func NewRepositorySyncerAndInit

func NewRepositorySyncerAndInit(logger logr.Logger, opts *Options, mtx *sync.Mutex) (*RepositorySyncer, error)

func (*RepositorySyncer) AddFilesAndCommit

func (r *RepositorySyncer) AddFilesAndCommit(commitMessage string, files ...string) error

func (*RepositorySyncer) Start

func (r *RepositorySyncer) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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