MCPcopy Create free account
hub / github.com/Scalingo/cli / Setup

Function Setup

git/setup.go:19–38  ·  view source on GitHub ↗
(ctx context.Context, appName string, params SetupParams)

Source from the content-addressed store, hash-verified

17}
18
19func Setup(ctx context.Context, appName string, params SetupParams) error {
20 repo, err := git.PlainOpen(".")
21 if err != nil {
22 return errors.Wrapf(ctx, err, "fail to initialize the Git repository")
23 }
24
25 url, err := getGitEndpoint(ctx, appName)
26 if err != nil {
27 return errors.Wrapf(ctx, err, "fail to get the Git endpoint of this app")
28 }
29 debug.Println("Adding Git remote", url)
30
31 err = putRemoteInRepository(ctx, repo, params.RemoteName, url, params.ForcePutRemote)
32 if err != nil {
33 return errors.Wrapf(ctx, err, "configure git remote %s", params.RemoteName)
34 }
35
36 io.Status("Successfully added the Git remote", params.RemoteName, "on", appName)
37 return nil
38}
39
40func putRemoteInRepository(ctx context.Context, repository *git.Repository, remoteName string, url string, force bool) error {
41 has, err := repositoryHasRemote(ctx, repository, remoteName)

Callers 1

git.goFile · 0.92

Calls 3

StatusFunction · 0.92
getGitEndpointFunction · 0.85
putRemoteInRepositoryFunction · 0.85

Tested by

no test coverage detected