MCPcopy
hub / github.com/kptdev/kpt / GetPkg

Method GetPkg

internal/util/diff/diff.go:331–343  ·  view source on GitHub ↗

GetPkg checks out a repository into a temporary directory for diffing and returns the directory containing the checked out package or an error. repo is the git repository the package was cloned from. e.g. https:// path is the sub directory of the git repository that the package was cloned from ref

(stagingDir, targetDir, repo, path, ref string)

Source from the content-addressed store, hash-verified

329// ref is the git ref the package was cloned from
330// refDesc is a human readable name of the reference
331func (pg defaultPkgGetter) GetPkg(stagingDir, targetDir, repo, path, ref string) (string, error) {
332 dir, err := stageDirectory(stagingDir, targetDir)
333 if err != nil {
334 return dir, err
335 }
336 cmdGet := &get.Command{
337 Git: kptfile.Git{Repo: repo, Directory: path, Ref: ref},
338 Destination: dir,
339 Clean: true,
340 }
341 err = cmdGet.Run()
342 return dir, err
343}
344
345// shortSha returns a shortened version of a commit SHA
346func shortSha(sha string) string {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.95
stageDirectoryFunction · 0.85

Tested by

no test coverage detected