MCPcopy Index your code
hub / github.com/devspace-sh/devspace / NewGitCLIRepository

Function NewGitCLIRepository

pkg/util/git/git.go:20–28  ·  view source on GitHub ↗

NewGitCLIRepository creates a new git repository struct with the given parameters

(ctx context.Context, localPath string)

Source from the content-addressed store, hash-verified

18
19// NewGitCLIRepository creates a new git repository struct with the given parameters
20func NewGitCLIRepository(ctx context.Context, localPath string) (*GitCLIRepository, error) {
21 if !isGitCommandAvailable(ctx) {
22 return nil, errors.New("git not found in path. Please make sure you have git installed to clone git dependencies")
23 }
24
25 return &GitCLIRepository{
26 LocalPath: localPath,
27 }, nil
28}
29
30func isGitCommandAvailable(ctx context.Context) bool {
31 _, err := command.Output(ctx, "", expand.ListEnviron(os.Environ()...), "git", "version")

Callers 5

DownloadBinaryMethod · 0.92
DownloadMetadataMethod · 0.92
DownloadDependencyFunction · 0.92
TestGitCliCommitFunction · 0.85
TestGitCliBranchFunction · 0.85

Calls 1

isGitCommandAvailableFunction · 0.85

Tested by 2

TestGitCliCommitFunction · 0.68
TestGitCliBranchFunction · 0.68