git

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 9 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 {
	// contains filtered or unexported fields
}

func New added in v0.26.0

func New(s Spec) (*Git, error)

New returns a new git object

func (*Git) Add

func (g *Git) Add(files []string) error

Add run `git add`.

func (*Git) Checkout

func (g *Git) Checkout() error

Checkout create and then uses a temporary git branch.

func (*Git) Clean

func (g *Git) Clean() error

Clean removes the current git repository from local storage.

func (*Git) Clone

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

Clone run `git clone`.

func (*Git) Commit

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

Commit run `git commit`.

func (*Git) GetBranches added in v0.53.0

func (g *Git) GetBranches() (sourceBranch, workingBranch, targetBranch string)

func (*Git) GetChangedFiles

func (g *Git) GetChangedFiles(workingDir string) ([]string, error)

func (*Git) GetDirectory

func (g *Git) GetDirectory() (directory string)

GetDirectory returns the working git directory.

func (*Git) GetURL added in v0.53.0

func (g *Git) GetURL() string

GetURL returns a git URL

func (*Git) IsRemoteBranchUpToDate added in v0.45.0

func (g *Git) IsRemoteBranchUpToDate() (bool, error)

IsRemoteBranchUpToDate checks if the working branch should be push to remote

func (*Git) Push

func (g *Git) Push() error

Push run `git push`.

func (*Git) PushBranch added in v0.44.0

func (g *Git) PushBranch(branch string) error

PushBranch push tags

func (*Git) PushTag

func (g *Git) PushTag(tag string) error

PushTag push tags

type Spec added in v0.26.0

type Spec struct {
	// URL specifies the git url
	URL string `yaml:",omitempty" jsonschema:"required"`
	// Username specifies the username for http authentication
	Username string `yaml:",omitempty"`
	// Password specifies the password for http authentication
	Password string `yaml:",omitempty"`
	// Branch specifies the git branch
	Branch string `yaml:",omitempty"`
	// User specifies the git commit author
	User string `yaml:",omitempty"`
	// Email specifies the git commit email
	Email string `yaml:",omitempty"`
	// Directory specifies the directory to use for cloning the repository
	Directory string `yaml:",omitempty"`
	// Force is used during the git push phase to run `git push --force`.
	Force bool `yaml:",omitempty"`
	// CommitMessage contains conventional commit metadata as type or scope, used to generate the final commit message.
	CommitMessage commit.Commit `yaml:",omitempty"`
	// GPG key and passphrased used for commit signing
	GPG sign.GPGSpec `yaml:",omitempty"`
}

Spec contains settings to manipulate a git repository.

func (*Spec) Merge added in v0.28.0

func (gs *Spec) Merge(child interface{}) error

Merge returns nil if it successfully merges the child Spec into target receiver. Please note that child attributes always overrides receiver's

func (*Spec) MergeFromEnv added in v0.28.0

func (gs *Spec) MergeFromEnv(envPrefix string)

MergeFromEnv updates the target receiver with the "non zero-ed" environment variables

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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