本文整理匯總了Golang中github.com/openshift/source-to-image/pkg/scm/git.Git.GetInfo方法的典型用法代碼示例。如果您正苦於以下問題:Golang Git.GetInfo方法的具體用法?Golang Git.GetInfo怎麽用?Golang Git.GetInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/source-to-image/pkg/scm/git.Git
的用法示例。
在下文中一共展示了Git.GetInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: fetchSource
// fetchSource retrieves the inputs defined by the build source into the
// provided directory, or returns an error if retrieval is not possible.
func fetchSource(dir string, build *api.Build, urlTimeout time.Duration, in io.Reader, git git.Git) (*s2iapi.SourceInfo, error) {
hasGitSource := false
// expect to receive input from STDIN
if err := extractInputBinary(in, build.Spec.Source.Binary, dir); err != nil {
return nil, err
}
// may retrieve source from Git
hasGitSource, err := extractGitSource(git, build.Spec.Source.Git, build.Spec.Revision, dir, urlTimeout)
if err != nil {
return nil, err
}
var sourceInfo *s2iapi.SourceInfo
if hasGitSource {
sourceInfo = git.GetInfo(dir)
}
// a Dockerfile has been specified, create or overwrite into the destination
if dockerfileSource := build.Spec.Source.Dockerfile; dockerfileSource != nil {
baseDir := dir
// if a context dir has been defined and we cloned source, overwrite the destination
if hasGitSource && len(build.Spec.Source.ContextDir) != 0 {
baseDir = filepath.Join(baseDir, build.Spec.Source.ContextDir)
}
return sourceInfo, ioutil.WriteFile(filepath.Join(baseDir, "Dockerfile"), []byte(*dockerfileSource), 0660)
}
return sourceInfo, nil
}