git

package
v1.22.21 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Zlib Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ArgsCommitLog = []string{"log", "--pretty=format:\"%h\"", "-1"}
	ArgsCommit    = []string{"rev-parse", "--short", "HEAD"}
	ArgsDirty     = []string{"status", "--porcelain"}
	ArgsBranch    = []string{"rev-parse", "--abbrev-ref", "HEAD"}
	ArgsDescribe  = []string{"describe", "--tags", "--always"}
	ArgsTag       = []string{"describe", "--abbrev=0", "--tags"}
)

Functions

This section is empty.

Types

type Cmd added in v1.8.68

type Cmd struct {
}

func (*Cmd) Do added in v1.8.68

func (c *Cmd) Do(ctx context.Context, env []string, args ...string) (string, error)

func (*Cmd) DoCmd added in v1.8.68

func (c *Cmd) DoCmd(ctx context.Context, env []string, args ...string) (string, error)

func (*Cmd) IsRepo added in v1.8.68

func (c *Cmd) IsRepo(ctx context.Context, env []string) bool

func (*Cmd) Version added in v1.8.68

func (c *Cmd) Version(ctx context.Context, env []string) string

Version sample v1.0.1

func (*Cmd) VersionNumber added in v1.8.68

func (c *Cmd) VersionNumber(ctx context.Context, env []string) string

VersionNumber sample 1.0.1

type Git

type Git struct {
	Url        string `json:"url"`
	SshKey     string `json:"ssh_key"`
	SshKeySalt string `json:"ssh_key_salt"`
	Path       string `json:"path"`
	Branch     string `json:"branch"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	DirUser    string `json:"dir_user"`
}

func (*Git) Checkout

func (g *Git) Checkout(name string) (err error)

func (*Git) CleanBranch

func (g *Git) CleanBranch() (err error)

func (*Git) Clone

func (g *Git) Clone() (r *git.Repository, err error)

func (*Git) CloneOptions

func (g *Git) CloneOptions() (opt git.CloneOptions, err error)

func (*Git) CreateBranch

func (g *Git) CreateBranch() (branchShortName, branchName string, err error)

CreateBranch 创建分支

func (*Git) CreateBranchName

func (g *Git) CreateBranchName() (name string, err error)

func (*Git) Fetch

func (g *Git) Fetch() (r *git.Repository, err error)

Fetch 拉取代码

func (*Git) FetchOptions

func (g *Git) FetchOptions() (opt git.FetchOptions, err error)

func (*Git) GetAuth

func (g *Git) GetAuth() (auth transport.AuthMethod, err error)

func (*Git) GetHash

func (g *Git) GetHash() (hash string, hashObj plumbing.Hash, r *git.Repository, ref *plumbing.Reference, err error)

GetHash 获取 hash

func (*Git) IsHTTP

func (g *Git) IsHTTP() bool

func (*Git) IsNeedAuth

func (g *Git) IsNeedAuth() bool

func (*Git) LastCommitId

func (g *Git) LastCommitId() (hash string, err error)

func (*Git) Publish

func (g *Git) Publish() (commitId string, err error)

func (*Git) Validate

func (g *Git) Validate() error

Jump to

Keyboard shortcuts

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