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

Method prepareForDiff

internal/util/diff/diff.go:306–315  ·  view source on GitHub ↗

prepareForDiff removes metadata such as .git and Kptfile from a staged package to exclude them from diffing.

(dir string)

Source from the content-addressed store, hash-verified

304// prepareForDiff removes metadata such as .git and Kptfile from a staged package
305// to exclude them from diffing.
306func (d *defaultPkgDiffer) prepareForDiff(dir string) error {
307 excludePaths := []string{".git", kptfile.KptFileName}
308 for _, path := range excludePaths {
309 path = filepath.Join(dir, path)
310 if err := os.RemoveAll(path); err != nil {
311 return err
312 }
313 }
314 return nil
315}
316
317// PkgGetter knows how to fetch a package given a git repo, path and ref.
318type PkgGetter interface {

Callers 1

DiffMethod · 0.95

Calls 1

RemoveAllMethod · 0.45

Tested by

no test coverage detected