 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- func AddSSHConfig(cfg config.PipedGit) (string, error)
- func MakeCommitURL(repoURL, hash string) (string, error)
- func MakeDirURL(repoURL, dir, branch string) (string, error)
- func MakeFileCreationURL(repoURL, dir, branch, filename, value string) (string, error)
- func NewRepo(dir, gitPath, remote, clonedBranch string, gitEnvs []string) *repo
- func ParseGitURL(rawURL string) (u *url.URL, err error)
- type Client
- type Commit
- type Option
- type Repo
- type Worktree
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoChange = errors.New("no change") ErrBranchNotFresh = errors.New("some refs were not updated") )
Functions ¶
func MakeCommitURL ¶
MakeCommitURL builds a link to the HTML page of the commit, using the given repoURL and hash.
func MakeDirURL ¶
MakeDirURL builds a link to the HTML page of the directory.
func MakeFileCreationURL ¶
MakeFileCreationURL builds a link to create a file under the given directory.
Types ¶
type Client ¶
type Client interface {
	// Clone clones a specific git repository to the given destination.
	Clone(ctx context.Context, repoID, remote, branch, destination string) (Repo, error)
	// Clean removes all cache data.
	Clean() error
}
    Client is a git client for cloning/fetching git repo. It keeps a local cache for faster future cloning.
type Commit ¶
type Commit struct {
	Author          string
	Committer       string
	CreatedAt       int
	Hash            string
	AbbreviatedHash string
	Message         string
	Body            string
}
    func (*Commit) GetTrailerValueByKey ¶ added in v0.51.0
type Option ¶
type Option func(*client)
func WithGitEnv ¶
func WithGitEnvForRepo ¶
func WithLogger ¶
func WithPassword ¶ added in v0.48.9
func WithUserName ¶
type Repo ¶
type Repo interface {
	GetPath() string
	GetClonedBranch() string
	Copy(dest string) (Worktree, error)
	CopyToModify(dest string) (Repo, error)
	ListCommits(ctx context.Context, visionRange string) ([]Commit, error)
	GetLatestCommit(ctx context.Context) (Commit, error)
	GetCommitForRev(ctx context.Context, rev string) (Commit, error)
	ChangedFiles(ctx context.Context, from, to string) ([]string, error)
	Checkout(ctx context.Context, commitish string) error
	CheckoutPullRequest(ctx context.Context, number int, branch string) error
	Clean() error
	CleanPath(ctx context.Context, relativePath string) error
	Pull(ctx context.Context, branch string) error
	MergeRemoteBranch(ctx context.Context, branch, commit, mergeCommitMessage string) error
	Push(ctx context.Context, branch string) error
	CommitChanges(ctx context.Context, branch, message string, newBranch bool, changes map[string][]byte, trailers map[string]string) error
}
    Repo provides functions to get and handle git data.
type Worktree ¶ added in v0.50.1
type Worktree interface {
	GetPath() string
	Clean() error
	Copy(dest string) (Worktree, error)
	Checkout(ctx context.Context, commitish string) error
}
    Worktree provides functions to get and handle git worktree. It is a separate checkout of the repository. It is used to make changes to the repository without affecting the main repository. Worktree always does checkout with the detached HEAD, so it doesn't affect the main repository.