MCPcopy Index your code
hub / github.com/rilldata/rill / GitConfig

Method GitConfig

cli/pkg/cmdutil/githelper.go:39–74  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

37}
38
39func (g *GitHelper) GitConfig(ctx context.Context) (*gitutil.Config, error) {
40 err := g.gitConfigMu.Acquire(ctx, 1)
41 if err != nil {
42 return nil, err
43 }
44 defer g.gitConfigMu.Release(1)
45 if g.gitConfig != nil && !g.gitConfig.IsExpired() {
46 return g.gitConfig, nil
47 }
48
49 c, err := g.h.Client()
50 if err != nil {
51 return nil, err
52 }
53
54 resp, err := c.GetCloneCredentials(ctx, &adminv1.GetCloneCredentialsRequest{
55 Org: g.org,
56 Project: g.project,
57 })
58 if err != nil {
59 return nil, err
60 }
61 if resp.GitRepoUrl == "" {
62 return nil, fmt.Errorf("project %q is not connected to a git repository", g.project)
63 }
64 g.gitConfig = &gitutil.Config{
65 Remote: resp.GitRepoUrl,
66 Username: resp.GitUsername,
67 Password: resp.GitPassword,
68 PasswordExpiresAt: resp.GitPasswordExpiresAt.AsTime(),
69 DefaultBranch: resp.GitPrimaryBranch,
70 Subpath: resp.GitSubpath,
71 ManagedRepo: resp.GitManagedRepo,
72 }
73 return g.gitConfig, nil
74}
75
76func (g *GitHelper) PushToNewManagedRepo(ctx context.Context, primaryBranch string) (*adminv1.CreateManagedGitRepoResponse, error) {
77 c, err := g.h.Client()

Callers 5

PushToManagedRepoMethod · 0.95
GitStatusMethod · 0.80
GitPullMethod · 0.80
GitPushMethod · 0.80
CloneCmdFunction · 0.80

Calls 6

IsExpiredMethod · 0.80
AcquireMethod · 0.65
GetCloneCredentialsMethod · 0.65
ErrorfMethod · 0.65
ReleaseMethod · 0.45
ClientMethod · 0.45

Tested by

no test coverage detected