git

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommitAndPushChanges

func AddCommitAndPushChanges(ctx context.Context,
	repo *goGit.Repository,
	workTree *goGit.Worktree,
	branch string,
	authMethod transport.AuthMethod,
	clusterName string,
	commitMessage string,
) plumbing.Hash

func CheckoutToDefaultBranchAndFetchUpdates added in v0.10.0

func CheckoutToDefaultBranchAndFetchUpdates(ctx context.Context,
	repo *goGit.Repository,
	workTree *goGit.Worktree,
	authMethod transport.AuthMethod,
)

Removes any unstaged changes in the current branch. Then checks out to the default branch and fetches all updates.

func CloneRepo

func CloneRepo(ctx context.Context,
	url,
	dirPath string,
	authMethod transport.AuthMethod,
) *goGit.Repository

Clones the given git repository into the given directory (only if the repo doesn't already exist in there). If the repo already exists, then it checks out to the default branch and fetches the latest changes.

func CreateAndCheckoutToBranch

func CreateAndCheckoutToBranch(ctx context.Context,
	repo *goGit.Repository,
	branch string,
	workTree *goGit.Worktree,
	authMethod transport.AuthMethod,
)

Discards all the changes in the current branch and checks out to the default branch first. Then, checks out to a new branhc with the given name. If a branch with that name already exists, then panics.

func GetCustomerGitServerHostName added in v0.9.0

func GetCustomerGitServerHostName(ctx context.Context) string

Returns hostname of customer's git server.

func GetDefaultBranchName

func GetDefaultBranchName(ctx context.Context,
	authMethod transport.AuthMethod,
	repo *goGit.Repository,
) string

func GetGitAuthMethod

func GetGitAuthMethod(ctx context.Context) (authMethod transport.AuthMethod)

func HardResetRepoToTag added in v0.12.0

func HardResetRepoToTag(ctx context.Context, repo *git.Repository, tag string)

func WaitUntilPRMerged

func WaitUntilPRMerged(ctx context.Context,
	repo *goGit.Repository,
	defaultBranchName string,
	commitHash plumbing.Hash,
	auth transport.AuthMethod,
	branchToBeMerged string,
)

TODO : Sometimes we get this error while trying to detect whether the branch has been merged or not : `unexpected EOF`. In that case, just retry instead of erroring out.

Types

This section is empty.

Jump to

Keyboard shortcuts

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