MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / Commit

Method Commit

pkg/cmd/project/convert/convert.go:183–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

181}
182
183func (co *ConvertOptions) Commit() error {
184 co.GitBranch.Value = check(co.GitBranch.Value, DefaultBranch)
185 if isDefaultBranchProtected(co) {
186 co.GitInitialCommitBranch.Value = check(co.GitInitialCommitBranch.Value, DefaultInitialCommitBranch)
187 }
188
189 co.GitBasePath.Value = check(co.GitBasePath.Value, DefaultBasePath)
190 co.GitInitialCommitMessage.Value = check(co.GitInitialCommitMessage.Value, DefaultGitCommitMessage)
191
192 gitPersistenceSettings, err := co.buildGitPersistenceSettings()
193 if err != nil {
194 return err
195 }
196
197 project, err := co.GetProjectCallback(co.Project.Value)
198 if err != nil {
199 return err
200 }
201
202 _, err = co.Client.Projects.ConvertToVcs(project, co.GitInitialCommitMessage.Value, co.GitInitialCommitBranch.Value, gitPersistenceSettings)
203 if err != nil {
204 return err
205 }
206 _, err = fmt.Fprintf(co.Out, "Successfully configured Config as Code on '%s'\n", project.GetName())
207 if err != nil {
208 return err
209 }
210
211 return nil
212}
213
214func check(value string, defaultValue string) string {
215 if value == "" {

Callers

nothing calls this directly

Calls 4

checkFunction · 0.85
isDefaultBranchProtectedFunction · 0.85
GetNameMethod · 0.65

Tested by

no test coverage detected