MCPcopy Create free account
hub / github.com/rilldata/rill / GitStatus

Method GitStatus

runtime/server/git.go:91–117  ·  view source on GitHub ↗

GitStatus implements RuntimeService.

(ctx context.Context, req *runtimev1.GitStatusRequest)

Source from the content-addressed store, hash-verified

89
90// GitStatus implements RuntimeService.
91func (s *Server) GitStatus(ctx context.Context, req *runtimev1.GitStatusRequest) (*runtimev1.GitStatusResponse, error) {
92 if !auth.GetClaims(ctx, req.InstanceId).Can(runtime.EditRepo) {
93 return nil, ErrForbidden
94 }
95 repo, release, err := s.runtime.Repo(ctx, req.InstanceId)
96 if err != nil {
97 return nil, err
98 }
99 defer release()
100
101 gs, err := repo.Status(ctx, req.RemoteBranch)
102 if err != nil {
103 return nil, fmt.Errorf("failed to get git status: %w", err)
104 }
105 if !gs.IsGitRepo {
106 return nil, status.Error(codes.FailedPrecondition, "not a git repository")
107 }
108 return &runtimev1.GitStatusResponse{
109 Branch: gs.Branch,
110 GithubUrl: gs.RemoteURL,
111 Subpath: gs.Subpath,
112 ManagedGit: gs.ManagedRepo,
113 LocalChanges: gs.LocalChanges,
114 LocalCommits: gs.LocalCommits,
115 RemoteCommits: gs.RemoteCommits,
116 }, nil
117}
118
119func (s *Server) ListGitCommits(ctx context.Context, req *runtimev1.ListGitCommitsRequest) (*runtimev1.ListGitCommitsResponse, error) {
120 if !auth.GetClaims(ctx, req.InstanceId).Can(runtime.EditRepo) {

Callers

nothing calls this directly

Calls 6

GetClaimsFunction · 0.92
CanMethod · 0.80
RepoMethod · 0.80
StatusMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected