command

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckoutHead

func CheckoutHead() *exec.Cmd

CheckoutHead returns command git checkout -qf FETCH_HEAD

func Fetch

func Fetch(remoteName, ref string) *exec.Cmd

Fetch fetches changes by ref, ref can be a tag, branch or pr. --depth=1 is used to limit fetching to the last commit from the tip of each remote branch history. e.g. git fetch origin +refs/heads/onboarding --depth=1

func InitGit

func InitGit(dir string) *exec.Cmd

InitGit creates an empty git repository. it returns command git init

func OAuthCloneURL

func OAuthCloneURL(token, address, owner, name, scheme string) string

func RemoteAdd

func RemoteAdd(remoteName, remote string) *exec.Cmd

RemoteAdd sets the remote origin for the repository.

func RemoteRemove

func RemoteRemove(remoteName string) *exec.Cmd

RemoteRemove removes the remote origin for the repository.

func RunGitCmds

func RunGitCmds(codehostDetail *codehost.Detail, repoOwner, repoName, branchName, remoteName string) error

func ShowLastLog

func ShowLastLog() *exec.Cmd

ShowLastLog returns command git --no-pager log --oneline -1 It shows last commit messge with sha

Types

type Command

type Command struct {
	Cmd *exec.Cmd
	// DisableTrace display command args
	DisableTrace bool
	// IgnoreError ingore command run error
	IgnoreError bool
}

type Repo

type Repo struct {
	Source       string `yaml:"source"`
	Address      string `yaml:"address"`
	Owner        string `yaml:"owner"`
	Name         string `yaml:"name"`
	RemoteName   string `yaml:"remote_name"`
	Branch       string `yaml:"branch"`
	PR           int    `yaml:"pr"`
	Tag          string `yaml:"tag"`
	CheckoutPath string `yaml:"checkout_path"`
	SubModules   bool   `yaml:"submodules"`
	OauthToken   string `yaml:"oauthToken"`
	User         string `yaml:"-"`
	Password     string `yaml:"-"`
	CheckoutRef  string `yaml:"checkout_ref"`
}

func (*Repo) BranchRef

func (r *Repo) BranchRef() string

BranchRef returns branch refs format e.g. refs/heads/master

Jump to

Keyboard shortcuts

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