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

Function ExtractGitRemote

cli/pkg/gitutil/gitutil.go:102–119  ·  view source on GitHub ↗

ExtractGitRemote extracts the first Git remote from the Git repository at projectPath. If remoteName is provided, it will return the remote with that name. If detectDotGit is true, it will look for a .git directory in parent directories.

(projectPath, remoteName string, detectDotGit bool)

Source from the content-addressed store, hash-verified

100// If remoteName is provided, it will return the remote with that name.
101// If detectDotGit is true, it will look for a .git directory in parent directories.
102func ExtractGitRemote(projectPath, remoteName string, detectDotGit bool) (Remote, error) {
103 remotes, err := ExtractRemotes(projectPath, detectDotGit)
104 if err != nil {
105 return Remote{}, err
106 }
107 if remoteName != "" {
108 for _, remote := range remotes {
109 if remote.Name == remoteName {
110 return remote, nil
111 }
112 }
113 return Remote{}, ErrGitRemoteNotFound
114 }
115 if len(remotes) == 0 {
116 return Remote{}, ErrGitRemoteNotFound
117 }
118 return remotes[0], nil
119}
120
121// ExtractRemotes extracts all Git remotes from the Git repository at projectPath.
122// If detectDotGit is true, it will look for a .git directory in parent directories.

Callers 5

PushToGithubMethod · 0.92
DeployProjectMethod · 0.92
testSelfHostedDeployFunction · 0.92
checkRillRepoFunction · 0.92
ConnectGithubFlowFunction · 0.92

Calls 1

ExtractRemotesFunction · 0.85

Tested by 1

testSelfHostedDeployFunction · 0.74