MCPcopy Create free account
hub / github.com/devfile/api / validateSingleRemoteGitSrc

Function validateSingleRemoteGitSrc

pkg/validation/projects.go:97–110  ·  view source on GitHub ↗

validateSingleRemoteGitSrc validates a git src for a single remote only

(objectType, objectName string, gitSource v1alpha2.GitLikeProjectSource)

Source from the content-addressed store, hash-verified

95
96// validateSingleRemoteGitSrc validates a git src for a single remote only
97func validateSingleRemoteGitSrc(objectType, objectName string, gitSource v1alpha2.GitLikeProjectSource) (err error) {
98 switch len(gitSource.Remotes) {
99 case 0:
100 err = &MissingRemoteError{objectType: objectType, objectName: objectName}
101 case 1:
102 if gitSource.CheckoutFrom != nil && gitSource.CheckoutFrom.Remote != "" {
103 err = validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, objectType, objectName)
104 }
105 default: // len(gitSource.Remotes) >= 2
106 err = &MultipleRemoteError{objectType: objectType, objectName: objectName}
107 }
108
109 return err
110}

Callers 2

ValidateComponentsFunction · 0.85
ValidateStarterProjectsFunction · 0.85

Calls 1

validateRemoteMapFunction · 0.85

Tested by

no test coverage detected