Documentation ¶
Index ¶
- func BashCmdExec(cmd string, workingDir string, environ []string, logPrefix string) error
- func CmdExec(cmdName string, cmdArgs []string, workingDir string, environ []string, ...) error
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func FileExists(filePath string) bool
- func GitCheckout(repoPath string, branchName string) error
- func GitClone(parentPath string, repositoryName string, gitRemote string) (string, error)
- func GitCommit(repoPath string, message string, signature *git2go.Signature) error
- func GitFetchPullRequest(repoPath string, pullRequestNumber string, localBranchName string, ...) error
- func GitFindNearestTagName(repoPath string) (string, error)
- func GitGenerateChangelog(repoPath string, baseSha string, headSha string) (string, error)
- func GitGenerateGitIgnore(repoPath string, ignoreType string) error
- func GitGetTagDetails(repoPath string, tagName string) (*pipeline.GitTagDetails, error)
- func GitMergeRemoteBranch(repoPath string, localBranchName string, baseBranchName string, ...) error
- func GitPush(repoPath string, localBranch string, remoteBranch string, tagName string) error
- func GitSignature(authorName string, authorEmail string) *git2go.Signature
- func GitTag(repoPath string, version string, message string, signature *git2go.Signature) (string, error)
- func LeftPad(s string, padStr string, pLen int) string
- func LeftPad2Len(s string, padStr string, overallLen int) string
- func PopulateTemplate(tmplString string, data interface{}) (string, error)
- func RightPad(s string, padStr string, pLen int) string
- func RightPad2Len(s string, padStr string, overallLen int) string
- func SnakeCaseToCamelCase(inputUnderScoreStr string) (camelCase string)
- func StripIndent(multilineStr string) string
- func UnsetEnv(prefix string) (restore func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BashCmdExec ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func FileExists ¶
func GitCheckout ¶
func GitClone ¶
Clone a git repo into a local directory. Credentials need to be specified by embedding in gitRemote url. TODO: this pattern may not work on Bitbucket/GitLab
func GitFetchPullRequest ¶
func GitFetchPullRequest(repoPath string, pullRequestNumber string, localBranchName string, srcPatternTmpl string, destPatternTmpl string) error
https://stackoverflow.com/questions/13638235/git-checkout-remote-reference https://gist.github.com/danielfbm/ba4ae91efa96bb4771351bdbd2c8b06f https://github.com/libgit2/git2go/issues/126 https://www.atlassian.com/git/articles/pull-request-proficiency-fetching-abilities-unlocked https://www.atlassian.com/blog/archives/how-to-fetch-pull-requests https://stackoverflow.com/questions/48806891/bitbucket-does-not-update-refspec-for-pr-causing-jenkins-to-build-old-commits
func GitFindNearestTagName ¶
Get the nearest tag on branch. tag must be nearest, ie. sorted by their distance from the HEAD of the branch, not the date or tagname. basically `git describe --tags --abbrev=0`
func GitGenerateChangelog ¶
func GitGenerateGitIgnore ¶
func GitGetTagDetails ¶
func GitGetTagDetails(repoPath string, tagName string) (*pipeline.GitTagDetails, error)
func GitMergeRemoteBranch ¶
func GitMergeRemoteBranch(repoPath string, localBranchName string, baseBranchName string, remoteUrl string, remoteBranchName string, signature *git2go.Signature) error
https://github.com/welaw/welaw/blob/100be9cf9a4c6d26f8126678c05072ff725202dd/pkg/easyrepo/merge.go#L11 https://gist.github.com/danielfbm/37b0ca88b745503557b2b3f16865d8c3 https://gist.github.com/danielfbm/ba4ae91efa96bb4771351bdbd2c8b06f https://github.com/Devying/git2go-example/blob/master/fetch1.go https://github.com/jandre/passward/blob/e37bce388cf6417d7123c802add1937574c2b30e/passward/git.go#L186-L206 https://github.com/electricbookworks/electric-book-gui/blob/4d9ad588dbdf7a94345ef10a1bb6944bc2a2f69a/src/go/src/ebw/git/RepoConflict.go
func PopulateTemplate ¶
func SnakeCaseToCamelCase ¶
func StripIndent ¶
func UnsetEnv ¶
func UnsetEnv(prefix string) (restore func())
UnsetEnv unsets all envars having prefix and returns a function that restores the env. Any newly added envars having prefix are also unset by restore. It is idiomatic to use with a defer.
defer UnsetEnv("ACME_")()
Note that modifying the env may have unpredictable results when tests are run with t.Parallel. NOTE: This is quick n' dirty from memory; write some tests for this code.
Types ¶
This section is empty.