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)
| 329 | // ref is the git ref the package was cloned from |
| 330 | // refDesc is a human readable name of the reference |
| 331 | func (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 |
| 346 | func shortSha(sha string) string { |
nothing calls this directly
no test coverage detected